-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Labels
In-PRIssues that have a PR open for them.Issues that have a PR open for them.Needs: Triage 🔍Label added to new issues which need TriageLabel added to new issues which need Triage
Description
Describe the bug
We have a health check API which we don't want the request go through the httpmodules. The code we use is like below. But the service log shows that health check API still uses httpmodules.
builder.Services.AddSystemWebAdapters()
.WrapAspNetCoreSession()
.AddHttpApplication<MyHttpApplication>(
(options) =>
{
options.RegisterModule<MyRequestModule>("MyRequestModule");
});
builder.Services.AddControllers();
WebApplication app = builder.Build();
app.UseRouting();
app.MapWhen(context=>context.Request.Path.StartsWithSegments("/health"), appBuilder =>
{
appBuilder.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
});
});
app.UseAuthenticationEvents();
app.UseAuthorizationEvents();
app.UseSystemWebAdapters();
endpoints.MapControllers();
To Reproduce
Set breakpoint in the MyRequestModule.
Use the code above to configure the application. And request /health.
Then the breakpoint will be hit.
Further technical details
- Targeted .NET version: 6.0
related change: ca4efe1#diff-95c988ab65d8fe816dc7b91795f6336762871d67123560dd8b6b24cd2b810a0b
In this change, HttpApplicationMiddleware is moved to IStartUpFilter. So even I don't set "UseSystemWebAdapters" for health check API, the middleware still run and httpmodules still work.
The stacktrace is as below.
Metadata
Metadata
Assignees
Labels
In-PRIssues that have a PR open for them.Issues that have a PR open for them.Needs: Triage 🔍Label added to new issues which need TriageLabel added to new issues which need Triage
