mirror of https://github.com/zulip/zulip.git
run-dev: Set HTTP header to show we're proxing from port 9991.
Previously, while Django code that relied on EXTERNAL_HOST and other settings would know the Zulip server is actually on port 9991, the upcoming Django SAML code in python-social-auth would end up detecting a port of 9992 (the one the Django server is actually listening on). We fix this using X-Forwarded-Port.
This commit is contained in:
parent
f25968f0ff
commit
f8928182cf
|
@ -319,6 +319,8 @@ class CombineHandler(BaseWebsocketHandler):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
if 'X-REAL-IP' not in self.request.headers:
|
if 'X-REAL-IP' not in self.request.headers:
|
||||||
self.request.headers['X-REAL-IP'] = self.request.remote_ip
|
self.request.headers['X-REAL-IP'] = self.request.remote_ip
|
||||||
|
if 'X-FORWARDED_PORT' not in self.request.headers:
|
||||||
|
self.request.headers['X-FORWARDED-PORT'] = str(proxy_port)
|
||||||
if self.request.headers.get("Upgrade", "").lower() == 'websocket':
|
if self.request.headers.get("Upgrade", "").lower() == 'websocket':
|
||||||
return super().prepare()
|
return super().prepare()
|
||||||
url = transform_url(
|
url = transform_url(
|
||||||
|
|
|
@ -150,3 +150,10 @@ BILLING_ENABLED = True
|
||||||
|
|
||||||
# Test Custom TOS template rendering
|
# Test Custom TOS template rendering
|
||||||
TERMS_OF_SERVICE = 'corporate/terms.md'
|
TERMS_OF_SERVICE = 'corporate/terms.md'
|
||||||
|
|
||||||
|
# Our run-dev.py proxy uses X-Forwarded-Port to communicate to Django
|
||||||
|
# that the request is actually on port 9991, not port 9992 (the Django
|
||||||
|
# server's own port); this setting tells Django to read that HTTP
|
||||||
|
# header. Important for SAML authentication in the development
|
||||||
|
# environment.
|
||||||
|
USE_X_FORWARDED_PORT = True
|
||||||
|
|
Loading…
Reference in New Issue