DEV Community

Discussion on: How to Host a Flask Server With Gunicorn and HTTPS

Collapse
 
biofool profile image
Kenneth Kron

OK the code sample in my question is not a good example. My issue is that I can't use url_for in flask as the redirect url sent to the browser is an http redirect. I've simplified the logic of my application to only use render_template and those all work.
Interestingly

    <a href="{{ url_for('auth.register') }}">Register</a>
Enter fullscreen mode Exit fullscreen mode

works (stays on the correct base url and port
but

redirect url_for('auth.register') 
Enter fullscreen mode Exit fullscreen mode

in python does not.
I've seen proxy_fix and other techniques for teaching flask to modify it's url_for generator but I haven't explored those yet.

relative hrefs in