alefranz / HeaderPropagation

ASP.NET Core middleware to propagate HTTP headers from the incoming request to the outgoing HTTP Client requests. This is a backport to ASP.NET Core 2.1 (and 2.2) of the ASP.NET Core HeaderPropagation middleware I had recently contributed to the ASP.NET Core project.
Apache License 2.0
31 stars 1 forks source link

Is the HeaderPropagationValues safe to use when injected in controller? #11

Closed Mubashwer closed 4 years ago

Mubashwer commented 4 years ago

I need to access a Correlation ID that is fetched from the request header or is generated.

Since HeaderPropagationValues uses AsyncLocals to store the header values and that there is a bug which causes AsyncLocals to bleed across requests, is it safe to use HeaderPropagationValues when injected in a controller?

alefranz commented 4 years ago

Yes, it is safe to use it. Version 3.0.2 includes a workaround to avoid that issue, so no matter in which position of the pipeline you add the middleware, you will not be affected.

Mubashwer commented 4 years ago

Thanks!