nginx-proxy/vhost-template.conf: Set X-Forwarded-Host
authorW. Trevor King <wking@tremily.us>
Fri, 10 Jan 2014 03:42:38 +0000 (19:42 -0800)
committerW. Trevor King <wking@tremily.us>
Fri, 10 Jan 2014 03:42:38 +0000 (19:42 -0800)
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

index 008ee2c65ec86f6b6f25443487092e5e1d9c322b..030056d518da9c8701b1af1950fd1509cead428c 100644 (file)
@@ -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;
        }
 }