AgentHostExtensions.UseHeaderPropagation Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| UseHeaderPropagation(IApplicationBuilder) |
Adds a middleware that collects headers to be propagated. |
| UseHeaderPropagation(IHostApplicationBuilder) |
Registers the HeaderPropagationMiddleware so that incoming request headers are propagated to outgoing requests. This builder-phase overload allows header propagation to be configured fluently alongside the other agent registration calls:
|
UseHeaderPropagation(IApplicationBuilder)
Adds a middleware that collects headers to be propagated.
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseHeaderPropagation(this Microsoft.AspNetCore.Builder.IApplicationBuilder app);
static member UseHeaderPropagation : Microsoft.AspNetCore.Builder.IApplicationBuilder -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseHeaderPropagation (app As IApplicationBuilder) As IApplicationBuilder
Parameters
The IApplicationBuilder to add the middleware to.
Returns
A reference to the app after the operation has completed.
Applies to
UseHeaderPropagation(IHostApplicationBuilder)
Registers the HeaderPropagationMiddleware so that incoming request headers are propagated to outgoing requests. This builder-phase overload allows header propagation to be configured fluently alongside the other agent registration calls:
builder.AddAgentDefaults()
.AddAgent<MyAgent>()
.UseHeaderPropagation()
.AddAgentAuthorization(b => b.AddAgentAspNetAuthentication());
public static Microsoft.Extensions.Hosting.IHostApplicationBuilder UseHeaderPropagation(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder);
static member UseHeaderPropagation : Microsoft.Extensions.Hosting.IHostApplicationBuilder -> Microsoft.Extensions.Hosting.IHostApplicationBuilder
<Extension()>
Public Function UseHeaderPropagation (builder As IHostApplicationBuilder) As IHostApplicationBuilder
Parameters
- builder
- IHostApplicationBuilder
The host application builder.
Returns
The same builder for chaining.
Remarks
This registers an IStartupFilter that inserts the middleware at the start of the request pipeline, ensuring request headers are captured before any agent endpoints run. This is equivalent to calling UseHeaderPropagation(IApplicationBuilder) on the built WebApplication; use one or the other, not both.