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

Redirecting to other website enforces https when it should not #1

Open
antoineleclair opened this issue Mar 20, 2017 · 1 comment
Open

Comments

@antoineleclair
Copy link

We have a website (https://example.com) with some URLs that moved to other sites, so we return 301s to those new URLs.

For example: https://example.com/old-url-that-moved should return a 301, with a Location header of http://other-site.com/new-url

The issue is that the redirect tween changes the scheme of the other domain to https, but the other domain does not serve the pages through https. In the example above, instead of redirecting to http://other-example.com/new-url like it should, users are redirected to https://other-example.com/new-url and the page does not load.

if 300 <= response.status_code < 400:
if response.location is not None:
response.location = secure_url(response.location)

@antoineleclair
Copy link
Author

Also, if this issue is fixed, the fix should probably respect the config to include or not the subdomains.

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

1 participant