I have tried everything I can but I cant get Force HTTPS.
@app.before_request
def before_request():
if not “https” in request.headers.get(“X-Forwarded-Proto”, “”):
url = request.url.replace(‘http://’, ‘https://’, 1)
code = 301
return redirect(url, code=code)
The above works when I’m not on the custom domain
but on the http://customdomain: request.headers.get(“X-Forwarded-Proto”, “”) returns https, http, http