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
@ -307,6 +307,11 @@ class Application:
|
|||||||
headers = pprint.pformat(self.headers_log(environ))
|
headers = pprint.pformat(self.headers_log(environ))
|
||||||
self.logger.debug("Request headers:\n%s", headers)
|
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
|
# Sanitize base prefix
|
||||||
environ["SCRIPT_NAME"] = storage.sanitize_path(
|
environ["SCRIPT_NAME"] = storage.sanitize_path(
|
||||||
environ.get("SCRIPT_NAME", "")).rstrip("/")
|
environ.get("SCRIPT_NAME", "")).rstrip("/")
|
||||||
|
Loading…
Reference in New Issue
Block a user