Allow custom forwarded for header
This commit is contained in:
parent
6146bc4dc2
commit
c24e212aac
3 changed files with 21 additions and 7 deletions
|
|
@ -29,7 +29,7 @@ http {
|
|||
{{ if $cfg.UseProxyProtocol }}
|
||||
real_ip_header proxy_protocol;
|
||||
{{ else }}
|
||||
real_ip_header X-Forwarded-For;
|
||||
real_ip_header {{ $cfg.ForwardedForHeader }};
|
||||
{{ end }}
|
||||
|
||||
real_ip_recursive on;
|
||||
|
|
@ -154,17 +154,14 @@ http {
|
|||
'' $server_port;
|
||||
}
|
||||
|
||||
map {{ buildForwardedFor $cfg.ForwardedForHeader }} $the_real_ip {
|
||||
default {{ buildForwardedFor $cfg.ForwardedForHeader }};
|
||||
{{ if $cfg.UseProxyProtocol }}
|
||||
map $http_x_forwarded_for $the_real_ip {
|
||||
default $http_x_forwarded_for;
|
||||
'' $proxy_protocol_addr;
|
||||
}
|
||||
{{ else }}
|
||||
map $http_x_forwarded_for $the_real_ip {
|
||||
default $http_x_forwarded_for;
|
||||
'' $realip_remote_addr;
|
||||
}
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
{{ if $all.IsSSLPassthroughEnabled }}
|
||||
# map port {{ $all.ListenPorts.SSLProxy }} to 443 for header X-Forwarded-Port
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue