Merge pull request #1109 from aledbf/fix-forward-headers
Cleanup remote address in nginx template
This commit is contained in:
commit
45e43f891e
1 changed files with 4 additions and 7 deletions
|
@ -26,18 +26,15 @@ events {
|
||||||
http {
|
http {
|
||||||
{{/* we use the value of the header X-Forwarded-For to be able to use the geo_ip module */}}
|
{{/* we use the value of the header X-Forwarded-For to be able to use the geo_ip module */}}
|
||||||
{{ if $cfg.UseProxyProtocol }}
|
{{ if $cfg.UseProxyProtocol }}
|
||||||
{{ range $trusted_ip := $cfg.ProxyRealIPCIDR }}
|
|
||||||
set_real_ip_from {{ $trusted_ip }};
|
|
||||||
{{ end }}
|
|
||||||
real_ip_header proxy_protocol;
|
real_ip_header proxy_protocol;
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $trusted_ip := $cfg.ProxyRealIPCIDR }}
|
|
||||||
set_real_ip_from {{ $trusted_ip }};
|
|
||||||
{{ end }}
|
|
||||||
real_ip_header X-Forwarded-For;
|
real_ip_header X-Forwarded-For;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
real_ip_recursive on;
|
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 */}}
|
{{/* databases used to determine the country depending on the client IP address */}}
|
||||||
{{/* http://nginx.org/en/docs/http/ngx_http_geoip_module.html */}}
|
{{/* http://nginx.org/en/docs/http/ngx_http_geoip_module.html */}}
|
||||||
|
@ -155,7 +152,7 @@ http {
|
||||||
{{ else }}
|
{{ else }}
|
||||||
map $http_x_forwarded_for $the_real_ip {
|
map $http_x_forwarded_for $the_real_ip {
|
||||||
default $http_x_forwarded_for;
|
default $http_x_forwarded_for;
|
||||||
'' $remote_addr;
|
'' $realip_remote_addr;
|
||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue