Skip to content

Commit b224c25

Browse files
committed
REST API: Send a Vary: Origin header on GET requests.
Add this header on all GET requests to prevent cached requests. Props darthhexx, davidbinda, nickdaugherty, whyisjake. Built from https://develop.svn.wordpress.org/trunk@46478 git-svn-id: http://core.svn.wordpress.org/trunk@46276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent b183fd1 commit b224c25

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: wp-includes/rest-api.php

+2
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ function rest_send_cors_headers( $value ) {
589589
header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' );
590590
header( 'Access-Control-Allow-Credentials: true' );
591591
header( 'Vary: Origin' );
592+
} else if ( 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) {
593+
header( 'Vary: Origin' );
592594
}
593595

594596
return $value;

Diff for: wp-includes/version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @global string $wp_version
1515
*/
16-
$wp_version = '5.3-beta3-46477';
16+
$wp_version = '5.3-beta3-46478';
1717

1818
/**
1919
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)