mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-13 18:50:53 +00:00
parent
1a78114a56
commit
360484e2d5
1 changed files with 8 additions and 3 deletions
|
@ -28,6 +28,11 @@ from radicale.log import logger
|
||||||
|
|
||||||
|
|
||||||
def get_server_netloc(environ: types.WSGIEnviron, force_port: bool = False):
|
def get_server_netloc(environ: types.WSGIEnviron, force_port: bool = False):
|
||||||
|
if environ.get("HTTP_X_FORWARDED_HOST"):
|
||||||
|
host = environ["HTTP_X_FORWARDED_HOST"]
|
||||||
|
proto = environ.get("HTTP_X_FORWARDED_PROTO") or "http"
|
||||||
|
port = "443" if proto == "https" else "80"
|
||||||
|
else:
|
||||||
host = environ.get("HTTP_HOST") or environ["SERVER_NAME"]
|
host = environ.get("HTTP_HOST") or environ["SERVER_NAME"]
|
||||||
proto = environ["wsgi.url_scheme"]
|
proto = environ["wsgi.url_scheme"]
|
||||||
port = environ["SERVER_PORT"]
|
port = environ["SERVER_PORT"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue