diff options
Diffstat (limited to 'newspipe/bootstrap.py')
-rw-r--r-- | newspipe/bootstrap.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py index 12044916..3905cd93 100644 --- a/newspipe/bootstrap.py +++ b/newspipe/bootstrap.py @@ -44,9 +44,20 @@ def set_logging( handler.setLevel(log_level) logger.setLevel(log_level) +class ReverseProxied(object): + def __init__(self, app, script_name): + self.app = app + self.script_name = script_name + + def __call__(self, environ, start_response): + environ['SCRIPT_NAME'] = self.script_name + return self.app(environ, start_response) + # Create Flask application application = Flask(__name__, instance_relative_config=True) +if "PREFIX" in application.config: + application.wsgi_app = ReverseProxied(application.wsgi_app, script_name=application.config["PREFIX"]) configuration = os.environ.get("NEWSPIPE_CONFIG", False) if configuration == "testing": application.debug = logging.DEBUG |