Index: src/wp-includes/rest-api/rest-functions.php
===================================================================
--- src/wp-includes/rest-api/rest-functions.php	(revision 35160)
+++ src/wp-includes/rest-api/rest-functions.php	(working copy)
@@ -254,6 +254,13 @@
 		$url = add_query_arg( 'rest_route', $path, $url );
 	}
 
+	if ( is_ssl() ) {
+		// If the current host is the same as REST URL host, force the REST URL scheme to HTTPS
+		if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
+			$url = set_url_scheme( $url, 'https' );
+		}
+	}
+
 	/**
 	 * Filter the REST URL.
 	 *
