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

Add a FORCE_URL_SCHEME option #481

Closed
mitsuhiko opened this issue Apr 9, 2012 · 10 comments
Closed

Add a FORCE_URL_SCHEME option #481

mitsuhiko opened this issue Apr 9, 2012 · 10 comments
Milestone

Comments

@mitsuhiko
Copy link
Contributor

It should be possible to force the URL scheme to https for all things. That includes URL generation as well as automatic redirect checks on all requests.

@pwaller
Copy link

pwaller commented Dec 17, 2014

I've just hit the problem that my application is generating a http url even though PREFERRED_URL_SCHEME is set to https. My understanding is that this should force it, but it does not work unless I pass it to _scheme everywhere, which is a big mess. Does anyone have any ideas how to fix this?

@untitaker
Copy link
Contributor

@pwaller Most likely a misconfiguration of your reverse-proxying. Check your WSGI environment with request.environ, also http://werkzeug.pocoo.org/docs/contrib/fixers/#werkzeug.contrib.fixers.ProxyFix

@pwaller
Copy link

pwaller commented Dec 17, 2014

Hm. It's behind an amazon ELB.

@pwaller
Copy link

pwaller commented Dec 17, 2014

(And therefore I think that X-Forwarded-Proto should be set for us...)

@untitaker
Copy link
Contributor

Yes, and you need to use the ProxyFix for this. The reason for this behavior not being the default is that this header might not be set in some configurations, in which case the HTTP client can forge this and related headers.

@pwaller
Copy link

pwaller commented Dec 17, 2014

Ah yes. Thanks :)

@untitaker untitaker modified the milestones: 0.9, 1.0, 0.11 Apr 25, 2015
@davidism davidism modified the milestones: 1.0, 0.11 Jun 1, 2016
@dorianpula
Copy link

It sounds like @pwaller's issue was resolved. But I assume this is still something we want to get working for 1.0?

@untitaker
Copy link
Contributor

I think nowadays people use different means of enforcing HTTPS, so this might not be that necessary. Still a nice feature to have.

@autoferrit
Copy link
Contributor

I am at the pycon sprints, I am going to see if I can add a config flag for adding this.

@jeffwidman
Copy link
Contributor

I don't really see the value here myself as it feels like something better handled at the webserver layer... my vote is to forgo this.

@davidism davidism closed this as completed Jun 3, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants