mirror of
https://github.com/kennethreitz/flask-sslify.git
synced 2026-06-05 23:00:19 +00:00
X-Forwarded-Proto[C
This commit is contained in:
+8
-1
@@ -16,6 +16,13 @@ class SSLify(object):
|
||||
|
||||
@staticmethod
|
||||
def redirect():
|
||||
if (not request.is_secure) and (not app.debug):
|
||||
|
||||
criteria = [
|
||||
request.is_secure,
|
||||
app.debug,
|
||||
request.headers.get('X-Forwarded-Proto', 'http') == 'https'
|
||||
]
|
||||
|
||||
if not any(criteria):
|
||||
url = request.url.replace('http://', 'https://')
|
||||
return redirect(url)
|
||||
Reference in New Issue
Block a user