From fb3c7c3714e7edbdca218f8cd0289411210e9d34 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Thu, 10 Aug 2017 11:41:14 -0400 Subject: [PATCH] Cleanup remote address in nginx template --- .../nginx/rootfs/etc/nginx/template/nginx.tmpl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index a3953e38a..b2268ccb6 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -26,18 +26,15 @@ events { http { {{/* we use the value of the header X-Forwarded-For to be able to use the geo_ip module */}} {{ if $cfg.UseProxyProtocol }} - {{ range $trusted_ip := $cfg.ProxyRealIPCIDR }} - set_real_ip_from {{ $trusted_ip }}; - {{ end }} real_ip_header proxy_protocol; {{ else }} - {{ range $trusted_ip := $cfg.ProxyRealIPCIDR }} - set_real_ip_from {{ $trusted_ip }}; - {{ end }} real_ip_header X-Forwarded-For; {{ end }} real_ip_recursive on; + {{ range $trusted_ip := $cfg.ProxyRealIPCIDR }} + set_real_ip_from {{ $trusted_ip }}; + {{ end }} {{/* databases used to determine the country depending on the client IP address */}} {{/* http://nginx.org/en/docs/http/ngx_http_geoip_module.html */}} @@ -155,7 +152,7 @@ http { {{ else }} map $http_x_forwarded_for $the_real_ip { default $http_x_forwarded_for; - '' $remote_addr; + '' $realip_remote_addr; } {{ end }}