You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CorrelationIdMiddlewareConfig.header_name changes the echoed header but not the one the request id is read from #116
CorrelationIdMiddlewareConfig.header_name only changes the header the request id is echoed in. ContextMiddleware still reads the incoming id from x-request-id, because its default extractors hardcode that key, and request_id_header is used only for the echo.
The FastAPI page presents it as the way to change the header name:
With that config, a caller sending X-Correlation-ID: abc gets a freshly minted id back in X-Correlation-ID, and abc never reaches the logs or outbound propagation. A caller sending X-Request-ID: abc gets abc back, but under the other header.
Proposal
When no explicit header mapping is given, read the request id from the same header it is echoed in: build the default extractors from request_id_header instead of the literal x-request-id. An explicit mapping (context_headers from #110, once merged) stays as given.
Acceptance
With header_name="X-Correlation-ID", a request carrying X-Correlation-ID: abc binds request_id=abc and gets abc back in X-Correlation-ID.
PR is up: #117, stacked on #115. Without an explicit mapping the request id is now read from request_id_header. The default config doesn't change. With a custom header_name, an incoming X-Request-ID is no longer read.
Activity
AlexeyShalaev commentedon Nov 13, 2026
PR is up: #117, stacked on #115. Without an explicit mapping the request id is now read from
request_id_header. The default config doesn't change. With a customheader_name, an incomingX-Request-IDis no longer read.