wp-codespace
wp-codespace copied to clipboard
Doesn't work, endless redirection
I started this according to instructions, after the build was completed I tried accessing port 80 for website, in my case the URL was: https://verbose-halibut-7vvjxqw67p2gqw-80.app.github.dev/
I got stuck in an endless redirection loop to https://verbose-halibut-7vvjxqw67p2gqw-443.app.github.dev/
Something in Wordpress is causing this because accessing a static file like https://verbose-halibut-7vvjxqw67p2gqw-80.app.github.dev/license.txt works and even accessing custom PHP files.
I found a fix for this, you need to prepend this to wp-config.php
:
<?php
if (
!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'
) {
$_SERVER['HTTPS'] = 'on';
}
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
?>
To get it working with Wordpress on GitHub Codespaces.
I am also having the same issue. The port says -80 but redirects to -443. The code above mentioned to be placed in the wp-config did not work either.
Has anyone found a fix for this issue - I am experiencing it too and the solution suggested by @cjohansson doesn’t resolve it for me. :(