Allow request id to be populated from specified HTTP request header
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading lib/private/AppFramework/Http/RequestId.php and the request setup around lib/private/Server.php line 927. Trace how request configuration is loaded and how the existing UNIQUE_ID and random-ID fallbacks are selected. Done means a configured non-empty request header is preferred, with the documented fallbacks preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100