mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
detect called by reverse proxy
This commit is contained in:
parent
c6bd129fa2
commit
7b4da3a128
1 changed files with 4 additions and 0 deletions
|
@ -192,14 +192,18 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
|
||||||
# Return response content
|
# Return response content
|
||||||
return status_text, list(headers.items()), answers
|
return status_text, list(headers.items()), answers
|
||||||
|
|
||||||
|
reverse_proxy = False
|
||||||
remote_host = "unknown"
|
remote_host = "unknown"
|
||||||
if environ.get("REMOTE_HOST"):
|
if environ.get("REMOTE_HOST"):
|
||||||
remote_host = repr(environ["REMOTE_HOST"])
|
remote_host = repr(environ["REMOTE_HOST"])
|
||||||
elif environ.get("REMOTE_ADDR"):
|
elif environ.get("REMOTE_ADDR"):
|
||||||
remote_host = environ["REMOTE_ADDR"]
|
remote_host = environ["REMOTE_ADDR"]
|
||||||
if environ.get("HTTP_X_FORWARDED_FOR"):
|
if environ.get("HTTP_X_FORWARDED_FOR"):
|
||||||
|
reverse_proxy = True
|
||||||
remote_host = "%s (forwarded for %r)" % (
|
remote_host = "%s (forwarded for %r)" % (
|
||||||
remote_host, environ["HTTP_X_FORWARDED_FOR"])
|
remote_host, environ["HTTP_X_FORWARDED_FOR"])
|
||||||
|
if environ.get("HTTP_X_FORWARDED_HOST") or environ.get("HTTP_X_FORWARDED_PROTO") or environ.get("HTTP_X_FORWARDED_SERVER"):
|
||||||
|
reverse_proxy = True
|
||||||
remote_useragent = ""
|
remote_useragent = ""
|
||||||
if environ.get("HTTP_USER_AGENT"):
|
if environ.get("HTTP_USER_AGENT"):
|
||||||
remote_useragent = " using %r" % environ["HTTP_USER_AGENT"]
|
remote_useragent = " using %r" % environ["HTTP_USER_AGENT"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue