HTTPS redirection for Flasks application


I would like to redirect the http requests to https requests with a flask application. The main issue is that the request I have server side is always http, even if the client sent an https request.
Here is the relevant code:

Hey! I’m actually working on the same thing right now – this is the most useful thread I’ve found on the subject (but it’s focused on node/express) Force HTTPS on project URL

and this is an article on the subject I’ve been reading from Miguel Grinberg’s flask tutorial:

In this example in node, they simply seem to redirect to an https url (serverside) on all requests – do you think that this means that they already have automatically generated certs available for glitch subdomains (or that we’re piggybacking off of the glitch domain…?)

I have a lot more reading to do on this, so I’ll check in as I sort things out, but wanted to share what I’ve found!

Hi !

Thank you @househaunt, I’ve checked if “https” is in the X-Forwarded-Proto" header instead of check against the begin of the url and it is working!!/tsi2?path=webapp/

Ah AMAZING! Thanks for updating!! :slight_smile: