From cc2c4276b2f54d283e373c39cd7552f6210fea86 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 9 Jan 2014 19:42:38 -0800 Subject: [PATCH] nginx-proxy/vhost-template.conf: Set X-Forwarded-Host Since v1.5, Django cares about the requested Host (or X-Forwarded-Host) [1], so we need to pass that information through. With this Nginx config, you can set USE_X_FORWARDED_HOST [2] and parse the appropriate hostname instead of your Docker container's IP. [1]: https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts [2]: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-USE_X_FORWARDED_HOST --- nginx-proxy/vhost-template.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx-proxy/vhost-template.conf b/nginx-proxy/vhost-template.conf index 008ee2c..030056d 100644 --- a/nginx-proxy/vhost-template.conf +++ b/nginx-proxy/vhost-template.conf @@ -39,5 +39,6 @@ server { location / { proxy_pass ${URL}; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; } } -- 2.26.2