Setting a trace id in nginx load balancer

nginx 1.11.0 added the new variable $request_id which is a unique identifier, so you can do something like:

   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

Leave a Comment