Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work, endless redirection #13

Open
cjohansson opened this issue Aug 31, 2023 · 3 comments
Open

Doesn't work, endless redirection #13

cjohansson opened this issue Aug 31, 2023 · 3 comments

Comments

@cjohansson
Copy link

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.

@cjohansson
Copy link
Author

cjohansson commented Sep 1, 2023

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.

@xBLADEx
Copy link

xBLADEx commented Oct 7, 2023

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.

@zagreusinoz
Copy link

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. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants