mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
Let reverse proxies overwrite script name
Reverse proxies can overwrite the script name with the HTTP header field X-Script-Name.
This commit is contained in:
parent
90486f33a5
commit
83046c80c4
1 changed files with 5 additions and 0 deletions
|
@ -307,6 +307,11 @@ class Application:
|
|||
headers = pprint.pformat(self.headers_log(environ))
|
||||
self.logger.debug("Request headers:\n%s", headers)
|
||||
|
||||
# Let reverse proxies overwrite SCRIPT_NAME
|
||||
if "HTTP_X_SCRIPT_NAME" in environ:
|
||||
environ["SCRIPT_NAME"] = environ["HTTP_X_SCRIPT_NAME"]
|
||||
self.logger.debug("Script name overwritten by client: %s",
|
||||
environ["SCRIPT_NAME"])
|
||||
# Sanitize base prefix
|
||||
environ["SCRIPT_NAME"] = storage.sanitize_path(
|
||||
environ.get("SCRIPT_NAME", "")).rstrip("/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue