diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index 28bb51c7..70b6d7cc 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -27,6 +27,7 @@ from flask_security.utils import login_user, logout_user from werkzeug.datastructures import ImmutableDict from werkzeug.local import LocalProxy from werkzeug.utils import find_modules +from werkzeug.middleware.proxy_fix import ProxyFix from pgadmin.model import db, Role, Server, ServerGroup, \ User, Keys, Version, SCHEMA_VERSION as CURRENT_SCHEMA_VERSION @@ -205,6 +206,11 @@ def create_app(app_name=None): """Create the Flask application, startup logging and dynamically load additional modules (blueprints) that are found in this directory.""" app = PgAdmin(__name__, static_url_path='/static') + + # Allow to run behind proxy + # https://werkzeug.palletsprojects.com/en/0.15.x/middleware/proxy_fix/#module-werkzeug.middleware.proxy_fix + app.wsgi_app = ProxyFix(app.wsgi_app) + # Removes unwanted whitespace from render_template function app.jinja_env.trim_blocks = True app.config.from_object(config)