Merge pull request #600 from lasharor/patch-2

Check for "SERVER_PORT" header before falling back to 9191
This commit is contained in:
SergeantPanda 2025-10-30 16:30:32 -05:00 committed by GitHub
commit 16c44ea851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2645,12 +2645,17 @@ def get_host_and_port(request):
if port:
return host, port
# 4. Dev fallback: guess port
# 4. Try SERVER_PORT from META
port = request.META.get("SERVER_PORT")
if port:
return host, port
# 5. Dev fallback: guess port
if os.environ.get("DISPATCHARR_ENV") == "dev" or host in ("localhost", "127.0.0.1"):
guess = "5656"
return host, guess
# 5. Fallback to scheme default
# 6. Fallback to scheme default
port = "443" if request.is_secure() else "9191"
return host, port