WordPress.org

Make WordPress Core

Ticket #36451: moha-36451.diff

File moha-36451.diff, 686 bytes (added by mohanjith, 3 years ago)
  • wp-includes/rest-api.php

     
    319319        }
    320320
    321321        if ( is_ssl() ) {
     322                $http_host = $_SERVER['SERVER_NAME'];
     323                if ( isset( $_SERVER['HTTP_HOST'] ) ) {
     324                        $http_host = $_SERVER['HTTP_HOST'];
     325                }
    322326                // If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS.
    323                 if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
     327                if ( $http_host === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
    324328                        $url = set_url_scheme( $url, 'https' );
    325329                }
    326330        }