问题原文
原帖链接 · guettli · CC BY-SA 3.0
I like X-Request-ID:
The Heroku router generates a unique request ID for every incoming HTTP request that it receives. This unique ID is then passed to your application as an HTTP header called X-Request-ID.
From https://devcenter.heroku.com/articles/http-request-id
How can I configure Apache to provide X-Request-ID which is different, even if a multi-threaded MPM gets used?
已采纳解答
原帖链接 · Michael Hampton · CC BY-SA 3.0
You need to do two things:
Load the unique_id_module. This provides the UNIQUE_ID environment variable which serves this purpose.
LoadModule mod_unique_id.cCopy the UNIQUE_ID into the
X-Request-IDheader in the appropriate virtual host using theRequestHeaderdirective.RequestHeader setifempty X-Request-ID %{UNIQUE_ID}e ProxyPass ... ProxyPassReverse ...
Optionally, you can also put %{UNIQUE_ID}e into a custom log format so that you can log it from Apache (possibly in addition to within your application).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
