Skip to content

Add X-Request-ID header to requests and logs - #148

Merged
kevinmcconnell merged 2 commits into
mainfrom
request-id
Aug 24, 2026
Merged

kevinmcconnell merged 2 commits into
mainfrom
request-id

Conversation

@kevinmcconnell

@kevinmcconnell kevinmcconnell commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Tag each request with an X-Request-ID header, so that the ID is available to the upstream server and recorded in our request logs as request_id.

When FORWARD_HEADERS is enabled, an ID supplied by a downstream proxy is kept, matching how we treat X-Forwarded-*.

Closes #139

Copilot AI balanced review requested due to automatic review settings August 24, 2026 12:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kevinmcconnell
kevinmcconnell force-pushed the request-id branch 6 times, most recently from 130dd12 to b116e89 Compare August 24, 2026 15:56
Tag each request with an X-Request-ID header, so that the ID is
available to the upstream server and recorded in our request logs
as request_id.

When FORWARD_HEADERS is enabled, an ID supplied by a downstream
proxy is kept, matching how we treat X-Forwarded-*.

Thruster owns the response header: the middleware sets it on
every response, and the proxy drops the upstream's echoed copy.
This keeps the ID out of the response cache, so cache hits carry
the ID of their own request rather than a replayed one.
ReverseProxy strips any header the client names in its Connection
header. That's correct hop-by-hop behavior for the client's own
headers, but X-Request-ID and X-Request-Start are ours: we add
them for the app, and the client shouldn't be able to suppress
them. Restore them in Rewrite, the same way the stdlib handles
X-Forwarded-*.
@kevinmcconnell
kevinmcconnell merged commit 318a0fc into main Aug 24, 2026
5 of 6 checks passed
@kevinmcconnell
kevinmcconnell deleted the request-id branch August 24, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: make Thruster aware of X-Request-Id in its access log

2 participants