remove base prefix from path (required for proper handling if called by reverse proxy)

This commit is contained in:
Peter Bieringer
2025-03-02 09:06:30 +01:00
parent 7b4da3a128
commit 280968e694
2 changed files with 29 additions and 14 deletions

View File

@@ -66,6 +66,8 @@ class ApplicationPartGet(ApplicationBase):
if path == "/.web" or path.startswith("/.web/"):
# Redirect to sanitized path for all subpaths of /.web
unsafe_path = environ.get("PATH_INFO", "")
if len(base_prefix) > 0:
unsafe_path = unsafe_path.removeprefix(base_prefix)
if unsafe_path != path:
location = base_prefix + path
logger.info("Redirecting to sanitized path: %r ==> %r",