WordPress.org

Make WordPress Core

Changeset 46487


Ignore:
Timestamp:
10/14/2019 05:43:52 PM (5 weeks ago)
Author:
whyisjake
Message:

REST API: Send a Vary: Origin header on GET requests.

Add this header on all GET requests to prevent cached requests.

Fixes some code dulication from [46484] and backports the changes from [46484] to the 5.2 branch.
Props darthhexx, davidbinda, nickdaugherty, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2/src/wp-includes/rest-api.php

    r46484 r46487  
    588588        header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' );
    589589        header( 'Access-Control-Allow-Credentials: true' );
    590         header( 'Vary: Origin', false );
    591     } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) {
    592590        header( 'Vary: Origin', false );
    593591    } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) {
Note: See TracChangeset for help on using the changeset viewer.