WordPress.org

Make WordPress Core

Changeset 46478


Ignore:
Timestamp:
10/14/2019 03:41:05 PM (6 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.

Props darthhexx, davidbinda, nickdaugherty, whyisjake.

File:
1 edited

Legend:

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

    r46456 r46478  
    589589        header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' );
    590590        header( 'Access-Control-Allow-Credentials: true' );
     591        header( 'Vary: Origin' );
     592    } else if ( 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) {
    591593        header( 'Vary: Origin' );
    592594    }
Note: See TracChangeset for help on using the changeset viewer.