mirror of
https://github.com/not-kennethreitz/flask-sslify.git
synced 2026-06-05 06:56:15 +00:00
Merge pull request #22 from mbr/blueprint-fix
Use current_app instead of hard-coupling extension to app.
This commit is contained in:
+2
-3
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from flask import request, redirect
|
||||
from flask import request, redirect, current_app
|
||||
|
||||
YEAR_IN_SECS = 31536000
|
||||
|
||||
@@ -19,7 +19,6 @@ class SSLify(object):
|
||||
def init_app(self, app):
|
||||
"""Configures the configured Flask app to enforce SSL."""
|
||||
|
||||
self.app = app
|
||||
app.before_request(self.redirect_to_ssl)
|
||||
app.after_request(self.set_hsts_header)
|
||||
|
||||
@@ -38,7 +37,7 @@ class SSLify(object):
|
||||
# Should we redirect?
|
||||
criteria = [
|
||||
request.is_secure,
|
||||
self.app.debug,
|
||||
current_app.debug,
|
||||
request.headers.get('X-Forwarded-Proto', 'http') == 'https'
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user