Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
middleware: Allow HTTP from localhost, not through a reverse proxy.
Alex Vandiver5368d1bd4c23
diff --git a/zerver/middleware.py b/zerver/middleware.pyindex 04ca9d57b55..2d5af328246 100644--- a/zerver/middleware.py+++ b/zerver/middleware.py@@ -636,7 +636,16 @@ class DetectProxyMisconfiguration(MiddlewareMixin):# misconfigured, but we cannot distinguish this from a random# client which is providing proxy headers to a correctly# configured Zulip.- if proxy_state_header != "" and not request.is_secure():+ #+ # There is a complication to the above logic -- we do expect+ # that requests not through the proxy may happen from+ # localhost over HTTP (e.g. the email gateway). Skip warnings+ # if the remote IP is localhost.+ if (+ proxy_state_header != ""+ and not request.is_secure()+ and request.META["REMOTE_ADDR"] not in ("127.0.0.1", "::1")+ ):raise ProxyMisconfigurationError(proxy_state_header)