Cleanup remote address in nginx template
@@ -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 }}
