Re: [flask] url_for not recognizing https on heroku
- Simon Sapin
- 2012-09-11 @ 10:13
Le 09/09/2012 16:08, Wael Orabi a écrit :
> hello flaskers,
> I have a small flask app deployed on heroku and I need it to work on
> https, heroku provide free https support for all apps on .heroku.com
> <http://heroku.com> domains (my case) my problem though is whenever I
> use "url_for" to redirect the user to another url, it redirects to the
> http not the https one. I'm guessing there's a sort of a proxy heroku
> are using to to direct the request to the app which is preventing it
> from recognizing the protocol.
> anyone had a similar experience before or can propose a solution that
> would force the app to use https?
Flask/Werkzeug use request.environ['wsgi.url_scheme'] to know whether a
given request is HTTP or HTTPS. Could you dump the content of the
request.environ dict for both an HTTP and HTTPS request on your app?