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.


git-svn-id: https://develop.svn.wordpress.org/trunk@46478 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2019-10-14 15:41:05 +00:00
parent f53a78fda7
commit 2a5c167b21

View File

@ -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;