mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Make flask respect https! :D See: https://stackoverflow.com/questions/14810795/flask-url-for-generating-http-url-instead-of-https/37842465#37842465
This commit is contained in:
parent
01bc246035
commit
814821a2bd
@ -7,6 +7,17 @@ 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()
|
||||
@ -17,6 +28,7 @@ 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)
|
||||
|
Loading…
Reference in New Issue
Block a user