Skip to content

Commit 0c6b6ef

Browse files
committed
Build: Fix 'home' for public stage sites
1 parent e294e3c commit 0c6b6ef

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sites.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,17 @@ function jquery_default_site_options() {
410410
// prevent the redirect, but changes the redirect to the local site.
411411
//
412412
// WordPress/wp-login.php requires 'home' to use a full URL.
413-
// If it uses a protocol-relative URL, it uses the entire URL as the path=
414-
// and thus cause cookies to never be sent by the browser.
413+
// If it uses a protocol-relative URL, it uses the entire URL as the "path="
414+
// and thus cause cookies to never be sent by the browser. This doesn't matter
415+
// much for the public stage sites where we don't login, but it matters for
416+
// jquery-wp-docker.
417+
//
418+
// To ensure canonical URLs work correctly on public stage sites and avoid
419+
// HTTP-403 errors, apply set_url_scheme() which will change it to stay on
420+
// HTTPS if you're already on HTTPS.
415421
if ( JQUERY_STAGING ) {
416-
$defaults['home'] = 'http://' . jquery_site_expand( JQUERY_LIVE_SITE );
417-
$defaults['siteurl'] = 'http://' . jquery_site_expand( JQUERY_LIVE_SITE );
422+
$defaults['home'] = set_url_scheme( 'http://' . jquery_site_expand( JQUERY_LIVE_SITE ) );
423+
$defaults['siteurl'] = set_url_scheme( 'http://' . jquery_site_expand( JQUERY_LIVE_SITE ) );
418424
}
419425
return $defaults;
420426

0 commit comments

Comments
 (0)