Use werkzeugs pre implemented ProxyFix middleware

This commit is contained in:
Patrick Jentsch
2020-05-27 12:52:41 +02:00
parent 814821a2bd
commit 94d99862bd
2 changed files with 8 additions and 13 deletions

View File

@ -7,17 +7,6 @@ from flask_sqlalchemy import SQLAlchemy
import logging
class CustomProxyFix(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
scheme = environ.get('HTTP_X_FORWARDED_PROTO')
if scheme:
environ['wsgi.url_scheme'] = scheme
return self.app(environ, start_response)
db = SQLAlchemy()
logger = logging.getLogger(__name__)
login_manager = LoginManager()
@ -28,7 +17,6 @@ socketio = SocketIO()
def create_app(config_name):
app = Flask(__name__)
app.wsgi_app = CustomProxyFix(app.wsgi_app)
app.config.from_object(config[config_name])
config[config_name].init_app(app)