Make WordPress Core

Ticket #34299: 34299.diff

File 34299.diff, 623 bytes (added by johnbillion, 9 years ago)
  • src/wp-includes/rest-api/rest-functions.php

     
    254254                $url = add_query_arg( 'rest_route', $path, $url );
    255255        }
    256256
     257        if ( is_ssl() ) {
     258                // If the current host is the same as REST URL host, force the REST URL scheme to HTTPS
     259                if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
     260                        $url = set_url_scheme( $url, 'https' );
     261                }
     262        }
     263
    257264        /**
    258265         * Filter the REST URL.
    259266         *