Allow request id to be populated from specified HTTP request header
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Is your feature request related to a problem? Please describe.
According to https://github.com/nextcloud/server/blob/56c45652ba726ef83efb51bdfcd93363a1a2a648/lib/private/AppFramework/Http/RequestId.php#L23 and https://github.com/nextcloud/server/blob/56c45652ba726ef83efb51bdfcd93363a1a2a648/lib/private/Server.php#L927 NC server use mod_uniq_id or random value to identify HTTP request. One cannot specify name of HTTP request header to get this ID from (i.e. to use ID generated by reverse proxy for log correlation).
Describe the solution you'd like
Introduce config parameter (i.e. request_id_header); when defined and not empty, check if request contains such header with non-empty value and use it as request id in NC server; otherwise use UNIQUE_ID if defined, otherwise generate random id.
Describe alternatives you've considered
Dirty workaround for Apache to use request IDs from X-Request-ID header set by reverse proxy:
# Set UNIQUE_ID from X-Request-ID header to simulate mod_unique_id behavior.
SetEnvIfNoCase ^X-Request-ID$ "(.+)" UNIQUE_ID=$1
It would be nice so we can get the span part of the OTEL trace-parent header. So don't limit it to just specifying the header but also allow us to do some regex manipulation to strip out the less useful parts of the OTEL trace-parent header.
Related recent change: #52782
Related recent change: #52782
This copies X-Request-ID (hardcoded header name) into clientReqId and does not replace random reqid generated by nc. Consider allowing to specify name of HTTP request header to get request ID from (i.e. to use ID generated by reverse proxy for log correlation; not as clientReqId but as main request id because it does not come from client but from reverse proxy and this should be used on error screens for example).