4

I found this sbange's answer about unique request ID in nginx upstreams. Here is a quote:

location / {
      proxy_pass http://upstream;
      proxy_set_header X-Request-Id $pid-$msec-$remote_addr-$request_length;
  }

It's looks nice, but it generates long and not very useful string. It would be better with a short hash (md5 for example).

Then I found this third-party nginx module ngx_http_set_hash. And of course, I can use a perl_modules for md5 functions. But, I trying to find some out-of-box, just with Nginx.

Can Nginx make hash value of some string or maybe someone know better method for generating short unique request id?

Community
  • 1
  • 1
kivagant
  • 1,849
  • 2
  • 24
  • 33

1 Answers1

1

The new $request_id variable now is available since Nginx v1.11.0.

kivagant
  • 1,849
  • 2
  • 24
  • 33