Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tornado: Fix Tornado CSRF check with X-Forwarded-Proto.
Anders Kaseorgce9ceb7f9f88
diff --git a/puppet/zulip/files/nginx/zulip-include-common/proxy b/puppet/zulip/files/nginx/zulip-include-common/proxyindex be2b6981624..756bbcd7b21 100644--- a/puppet/zulip/files/nginx/zulip-include-common/proxy+++ b/puppet/zulip/files/nginx/zulip-include-common/proxy@@ -3,6 +3,7 @@ proxy_http_version 1.1;# http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepaliveproxy_set_header Connection "";proxy_set_header Host $host;+proxy_set_header X-Forwarded-Proto $scheme;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Real-Ip $remote_addr;proxy_next_upstream off;diff --git a/zerver/management/commands/runtornado.py b/zerver/management/commands/runtornado.pyindex a0339a2f539..ca13be9f9b7 100644--- a/zerver/management/commands/runtornado.py+++ b/zerver/management/commands/runtornado.py@@ -13,6 +13,8 @@ from tornado import autoreloadfrom tornado.platform.asyncio import AsyncIOMainLoopsettings.RUNNING_INSIDE_TORNADO = True+if settings.PRODUCTION:+ settings.SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")from zerver.lib.async_utils import NoAutoCreateEventLoopPolicyfrom zerver.lib.debug import interactive_debug_listen