docs(public): document StatusCodePages middleware ordering constraint
This commit is contained in:
@@ -76,12 +76,13 @@ The middleware pipeline in `Program.cs` is ordered as follows:
|
|||||||
|
|
||||||
1. `UseForwardedHeaders()` — reads `X-Forwarded-*` headers from nginx. HTTPS redirect is conditionally disabled via `ForwardedHeaders:DisableHttpsRedirection` so the app can sit behind a reverse proxy without forcing HTTPS at the host level.
|
1. `UseForwardedHeaders()` — reads `X-Forwarded-*` headers from nginx. HTTPS redirect is conditionally disabled via `ForwardedHeaders:DisableHttpsRedirection` so the app can sit behind a reverse proxy without forcing HTTPS at the host level.
|
||||||
2. Exception handler and HTTPS redirect (production only).
|
2. Exception handler and HTTPS redirect (production only).
|
||||||
3. `UseAntiforgery()` — required by Blazor form handling.
|
3. `UseStatusCodePagesWithReExecute("/404", createScopeForStatusCodePages: true)` — must sit *before* `UseAntiforgery()` so that re-executed requests (e.g. the `/404` route) pass through antiforgery middleware before reaching the endpoint. Placing it after `UseAntiforgery()` causes an `InvalidOperationException` on re-execution.
|
||||||
4. **`UseStaticFiles()`** — serves compiled static assets from `wwwroot/` (including `/js/audio/*.js` compiled from TypeScript) with correct MIME types (`application/javascript` for `.js`). This must run *before* `MapStaticAssets()` to ensure production audio interop loads correctly.
|
4. `UseAntiforgery()` — required by Blazor form handling.
|
||||||
5. Cache-control middleware (dev only) — disables caching for `/_framework` and `/_content` assets.
|
5. **`UseStaticFiles()`** — serves compiled static assets from `wwwroot/` (including `/js/audio/*.js` compiled from TypeScript) with correct MIME types (`application/javascript` for `.js`). This must run *before* `MapStaticAssets()` to ensure production audio interop loads correctly.
|
||||||
6. `MapStaticAssets()` — endpoint mapper for Blazor framework assets and remaining static content.
|
6. Cache-control middleware (dev only) — disables caching for `/_framework` and `/_content` assets.
|
||||||
7. Development-only `UseStaticFiles()` — serves raw TypeScript from `/Interop/` for source-map debugging.
|
7. `MapStaticAssets()` — endpoint mapper for Blazor framework assets and remaining static content.
|
||||||
8. `MapControllers()` and `MapRazorComponents()` — route controller and component requests.
|
8. Development-only `UseStaticFiles()` — serves raw TypeScript from `/Interop/` for source-map debugging.
|
||||||
|
9. `MapControllers()` and `MapRazorComponents()` — route controller and component requests.
|
||||||
|
|
||||||
## The proxy controller
|
## The proxy controller
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user