diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py index 97c91a4196a..47e564d3d79 100644 --- a/web/pgadmin/utils/__init__.py +++ b/web/pgadmin/utils/__init__.py @@ -838,8 +838,12 @@ def get_safe_post_login_redirect(): allow_list = [ url_for('browser.index') ] + if "SCRIPT_NAME" in os.environ and os.environ["SCRIPT_NAME"]: + allow_list.append(os.environ["SCRIPT_NAME"]) + url = get_post_login_redirect() - if url in allow_list: - return url + for item in allow_list: + if url.startswith(item): + return url - return "/" + return os.environ.get("SCRIPT_NAME", "/")