question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a header propagation middleware and message handler

See original GitHub issue

We 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
davidfowlcommented, Oct 13, 2018

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.

3reactions
alefranzcommented, May 7, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found