Fix remote address in log when protocol is https
This commit is contained in:
parent
5c9c5a301a
commit
4bd4bf3be6
3 changed files with 27 additions and 19 deletions
|
|
@ -85,6 +85,9 @@ http {
|
|||
|
||||
server_tokens {{ if $cfg.ShowServerTokens }}on{{ else }}off{{ end }};
|
||||
|
||||
# disable warnings
|
||||
uninitialized_variable_warn off;
|
||||
|
||||
log_format upstreaminfo '{{ buildLogFormatUpstream $cfg }}';
|
||||
|
||||
{{/* map urls that should not appear in access.log */}}
|
||||
|
|
@ -127,6 +130,16 @@ http {
|
|||
'' $server_port;
|
||||
}
|
||||
|
||||
map $pass_access_scheme $the_x_forwarded_for {
|
||||
default $remote_addr;
|
||||
https $proxy_protocol_addr;
|
||||
}
|
||||
|
||||
map $pass_access_scheme $the_real_ip {
|
||||
default $remote_addr;
|
||||
https $proxy_protocol_addr;
|
||||
}
|
||||
|
||||
# map port 442 to 443 for header X-Forwarded-Port
|
||||
map $pass_server_port $pass_port {
|
||||
442 443;
|
||||
|
|
@ -352,7 +365,8 @@ http {
|
|||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $the_real_ip;
|
||||
proxy_set_header X-Forwarded-For $the_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $best_http_host;
|
||||
proxy_set_header X-Forwarded-Port $pass_port;
|
||||
proxy_set_header X-Forwarded-Proto $pass_access_scheme;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue