From 41693494b0c696542da4ebf54646d8978799d407 Mon Sep 17 00:00:00 2001 From: Youen Date: Sun, 14 Aug 2022 18:48:26 +0200 Subject: [PATCH] added possibility to run behind a reverse proxy --- src/app.py | 4 ++++ src/app_config.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/app.py b/src/app.py index aba1385..37a2a51 100644 --- a/src/app.py +++ b/src/app.py @@ -28,6 +28,10 @@ def create_app(): if len(secret_key) < 20: raise Exception("Internal error: insecure secret key") app.secret_key = secret_key + + if app.config['BEHIND_REVERSE_PROXY']: + from werkzeug.middleware.proxy_fix import ProxyFix + app.wsgi_app = ProxyFix(app.wsgi_app) from api import api_document app.register_blueprint(api_document.bp) diff --git a/src/app_config.py b/src/app_config.py index c283e0b..a0c629e 100644 --- a/src/app_config.py +++ b/src/app_config.py @@ -6,3 +6,5 @@ DATA_ROOT_DIR = os.path.realpath(src_path+'/../data') DOCUMENT_ROOT_DIR = os.path.realpath(DATA_ROOT_DIR+'/doc') ADMIN_PASSWORD = '' # You must override this in config.py or the application won't start + +BEHIND_REVERSE_PROXY = False