Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

nginx: Hardcode a Host: header to uwsgi when making health checks.

Alex Vandiveraef2d28194de
diff --git a/puppet/zulip/templates/nginx/healthcheck.conf.template.erb b/puppet/zulip/templates/nginx/healthcheck.conf.template.erb
index bad4a7d98d2..1af292ff49e 100644
--- a/puppet/zulip/templates/nginx/healthcheck.conf.template.erb
+++ b/puppet/zulip/templates/nginx/healthcheck.conf.template.erb
@@ -9,4 +9,13 @@ location /health {
deny all;
include uwsgi_params;
+
+ # Healthchecks may not supply a Host header; but also nothing in
+ # the response is host-specific, as the Django processes
+ # themselves are what are being healthchecked. we hardcode a Host
+ # that we know is in ALLOWED_HOSTS. The alternative is injecting
+ # a new Django middleware before
+ # `django.middleware.security.SecurityMiddleware` which only kicks
+ # in for this one specific path.
+ uwsgi_param HTTP_HOST "127.0.0.1";
}