From: W. Trevor King Date: Fri, 10 Jan 2014 03:42:38 +0000 (-0800) Subject: nginx-proxy/vhost-template.conf: Set X-Forwarded-Host X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cc2c4276b2f54d283e373c39cd7552f6210fea86;p=dockerfile.git 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 --- 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; } }