Files
discourse/lib/middleware
Martin Brennan fb4bd7951a FIX: Add request tracking headers to Message Bus responses (#35537)
Previously, we didn't pass through the `X-Discourse-Trackview` and
`X-Discourse-Browserpageview` headers in the MessageBus `/poll`
response.
This is because MessageBus has a specific way of defining extra headers,
which we do in the `004-message_bus.rb` initializer.

We were adding the `X-Discourse-*` headers in `RequestTracker` after
`@app.call` was called, so the MessageBus middleware which is lower in
the
middleware stack would not have access to this data.

So in this commit, we hoist this data collection about the request
tracking above the `@app.call` line so it's acceessible in the
MessageBus middleware and we can add them to the response there. We
also move this data collection into a reusable method so we can call it
from before the env and also later when actually logging the request.

Followup 33abb858e9
2025-10-27 12:21:37 +10:00
..