Detect if header injected request_id before creating one

This commit is contained in:
Giancarlo Rubio 2018-04-17 14:32:43 +02:00
parent 4bc943a77d
commit c60ed24f4b
5 changed files with 11 additions and 4 deletions

View file

@ -273,6 +273,13 @@ http {
'' $this_host;
}
# Reverse proxies can detect if a client provides a X-Request-ID header, and pass it on to the backend server.
# If no such header is provided, it can provide a random value.
map $http_x_request_id $req_id {
default $http_x_request_id;
"" $request_id;
}
{{ if $cfg.ComputeFullForwardedFor }}
# We can't use $proxy_add_x_forwarded_for because the realip module
# replaces the remote_addr too soon