Skip to content
Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
whyisjake committed Oct 14, 2019
1 parent b183fd1 commit b224c25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions wp-includes/rest-api.php
Expand Up @@ -589,6 +589,8 @@ function rest_send_cors_headers( $value ) {
header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Vary: Origin' );
} else if ( 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) {
header( 'Vary: Origin' );
}

return $value;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-beta3-46477';
$wp_version = '5.3-beta3-46478';

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

0 comments on commit b224c25

Please sign in to comment.