Patrick Jentsch 2020-05-27 11:36:28 +02:00
parent 01bc246035
commit 814821a2bd

View File

@ -7,6 +7,17 @@ from flask_sqlalchemy import SQLAlchemy
import logging 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() db = SQLAlchemy()
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
login_manager = LoginManager() login_manager = LoginManager()
@ -17,6 +28,7 @@ socketio = SocketIO()
def create_app(config_name): def create_app(config_name):
app = Flask(__name__) app = Flask(__name__)
app.wsgi_app = CustomProxyFix(app.wsgi_app)
app.config.from_object(config[config_name]) app.config.from_object(config[config_name])
config[config_name].init_app(app) config[config_name].init_app(app)