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

fixed redirect loop on reverse Proxies (at least Caddy) #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Thomas131
Copy link

@Thomas131 Thomas131 commented Aug 26, 2017

Here, I check, if the HTTP_X_FORWARDED_PROTO-Header was set. If yes, the protocol specified here is used for building the current URL. The patch was successfully tested on a Webserver with Caddy as reverse Proxy. It should also work on CF and most other reverse Proxies.

This fixes #48.

Sorry, if I did something wrong, I am not experienced with Pull Requests ...

@frostschutz frostschutz mentioned this pull request Dec 9, 2017
@frostschutz
Copy link
Owner

Sorry for the long silence.

I will add support for HTTP_X_FORWARDED_PROTO but I plan to make it optional (as a setting).

This redirect code was written a long time ago, when we didn't have cloudflare, or free letsencrypt https certificates for everyone. Nowadays every new site has https and already global http <-> https redirects in place, so perhaps it's time for Google SEO to stop even trying to do http <-> https redirects by itself, since it's safe to assume it will already be taken care of by the webserver.

So I think I will change it so that by default, no https redirect will take place, but users can optionally select for HTTP_X_FORWARDED_PROTO, or regular HTTPS header to be used (current workaround is to just SetEnv HTTPS 1 in the .htaccess). And if there are other relevant headers in the future they could be added to the list of options.

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

Successfully merging this pull request may close these issues.

https redirect
2 participants