fix: remove UseStatusCodePagesWithReExecute — was turning 401 into 400

UseStatusCodePagesWithReExecute('/not-found') intercepts all 4xx
responses and re-executes the pipeline as POST /not-found.
Since /not-found is a Blazor component requiring antiforgery, the
re-executed POST would fail with 400 (no CSRF token).

API controllers now return proper 401/403 for unauthenticated
requests. All 61 integration tests pass.
This commit is contained in:
Arnaud Dartois committed 2026-07-21 07:38:38 +00:00
1 parent f7c5f7a80a
commit ed686718d3
2 files changed
+1 -1

No files matched your search

-1
View File
@@ -233,7 +233,6 @@ if (!app.Environment.IsDevelopment())
app.UseHsts();
}
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
app.UseHttpsRedirection();
app.UseStaticFiles();