nginx-proxy/vhost-template.conf: Use $proxy_add_x_forwarded_for
authorW. Trevor King <wking@tremily.us>
Fri, 10 Jan 2014 03:41:12 +0000 (19:41 -0800)
committerW. Trevor King <wking@tremily.us>
Fri, 10 Jan 2014 03:41:12 +0000 (19:41 -0800)
Instead of $remote_addr.  This gives a chain of remote addresses if we
have multiple layers of proxies [1]:

  $proxy_add_x_forwarded_for

  Contains client request-header "X-Forwarded-For" with separated by
  comma $remote_addr. If there is no X-Forwarded-For request-header,
  than $proxy_add_x_forwarded_for is equal to $remote_addr.

[1]: http://wiki.nginx.org/HttpProxyModule#.24proxy_add_x_forwarded_for

nginx-proxy/vhost-template.conf

index 77c403e4e2d76f543d26e94c98a454beb43aa787..008ee2c65ec86f6b6f25443487092e5e1d9c322b 100644 (file)
@@ -38,6 +38,6 @@ server {
 
        location / {
                proxy_pass ${URL};
-               proxy_set_header X-Forwarded-For $remote_addr;
+               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
 }