Make WordPress Core

Ticket #40011: 40011.diff

File 40011.diff, 660 bytes (added by joehoyle, 8 years ago)
  • src/wp-includes/rest-api.php

    diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
    index e6cdc3a..6344eff 100644
    a b function rest_send_cors_headers( $value ) { 
    525525        $origin = get_http_origin();
    526526
    527527        if ( $origin ) {
    528                 header( 'Access-Control-Allow-Origin: ' . esc_url_raw( $origin ) );
     528                if ( 'null' !== $origin ) {
     529                        $origin = esc_url_raw( $origin );
     530                }
     531                header( 'Access-Control-Allow-Origin: ' . $origin );
    529532                header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' );
    530533                header( 'Access-Control-Allow-Credentials: true' );
    531534                header( 'Vary: Origin' );