Add a header propagation middleware and message handler
See original GitHub issueWe should consider providing an in-the-box solution for propagating headers from the current request to an outgoing http request.
This would consist of a middleware that can be configured to stamp certain headers on a feature of the current request. Then a message handler uses IHttpContextAccessor
to grab the feature and apply the headers to outgoing requests.
Maybe similar to: https://github.com/stevejgordon/CorrelationId/tree/dev/src/CorrelationId from @stevejgordon or (sample @davidfowl made)
Also consider using Activity
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:25 (11 by maintainers)
Top Results From Across the Web
Microsoft.AspNetCore.HeaderPropagation Namespace
A message handler for propagating headers collected by the HeaderPropagationMiddleware to a outgoing request. HeaderPropagationMessageHandlerEntry. Define the ...
Read more >HeaderPropagationHttpClientBui...
AddHeaderPropagation (IHttpClientBuilder). Adds a message handler for propagating headers collected by the HeaderPropagationMiddleware to a outgoing request. C#
Read more >Header propagation using ASP.NET Core - Craft Bakery
Imagine that you have REST API that calls external REST API. And you have to propagate requested HTTP headers to external API.
Read more >Propagate headers with .NET Core Web API | by Nuno Reis
Today we are going to learn how to propagate any header you receive onto another HTTP service using .NET Core Web API.
Read more >How to propagate HTTP Headers (and Correlation IDs) ...
Propagating HTTP Headers can be useful, especially when dealing with Correlation IDs. ... Add(new HeaderPropagationMessageHandler(_options, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s the sample I wrote https://gist.github.com/davidfowl/c34633f1ddc519f030a1c0c5abe8e867. This is just generic header propagation not tied to any specific implementation of activities or id generation etc.
I’ve aslo published an unofficial backport to AspNetCore 2.1 and 2.2. https://www.nuget.org/packages/HeaderPropagation/
I’ll update it now with the latest changes.