add support for non-standard server ports

This commit is contained in:
Peter Bieringer 2023-04-30 08:58:50 +02:00
parent ecafa1d32b
commit a3aa0ce7d9

View file

@ -32,6 +32,7 @@ def get_server_netloc(environ: types.WSGIEnviron, force_port: bool = False):
host = environ["HTTP_X_FORWARDED_HOST"]
proto = environ.get("HTTP_X_FORWARDED_PROTO") or "http"
port = "443" if proto == "https" else "80"
port = environ["HTTP_X_FORWARDED_PORT"] or port
else:
host = environ.get("HTTP_HOST") or environ["SERVER_NAME"]
proto = environ["wsgi.url_scheme"]