I\'m using nginx as a load balancer in front of several upstream app servers and I want to set a trace id to use to correlate requests with the app server logs. What\'s the bes
nginx 1.11.0 added the new variable $request_id which is a unique identifier, so you can do something like:
$request_id
location / { proxy_pass http://upstream; proxy_set_header X-Request-Id $request_id; }
See reference at http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_id