Herstel: admin-bestanden geven 404 in PrerenderedPages-modus

De catch-all 404-route van de website werd ook voor /admin/... gekozen, waardoor de
static-file-middleware (die routes met endpoint overslaat) de adminbestanden niet
serveerde. Een routeconstraint houdt de gereserveerde prefixes buiten die route.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 11:12:13 +01:00
co-authored by Claude Sonnet 5.5
parent 05fe0f1f0e
commit d0c1d26c5c
4 changed files with 101 additions and 2 deletions
@@ -454,3 +454,9 @@
**Run**: 608, workflow_dispatch on feature/andreaslop-site-hosting (deploy_asf_test=true only; test/production false). All gates green, publish-asf-test and deploy-asf-test succeeded (health check through https://test.andreaslop.nl/health passed), SlpSoftware jobs skipped.
**Verification by curl (https://test.andreaslop.nl)**: / 200 with full header set (CSP byte-exact, HSTS, nosniff, DENY, Referrer-Policy, X-Robots-Tag noindex), Cache-Control no-cache; /assets immutable; gzip on GET, no br; /Over-Mij -> 301 /over-mij; /a%3Fb/ -> 301 /a%3Fb; /doesnotexist and /404.html -> 404 with the 404 page and headers; /api/v1/onbekend-pad -> 404 empty; /robots.txt Disallow: /; POST on a page -> 405 Allow: GET, HEAD; /health 200 (version 1.0.0+91f14d5); /admin/ 200 with theme favicon; capabilities = Identity, Availability; Setup status = initialized false, tokenRequired true.
**Observations**: bare `curl -X POST /` (no body/Content-Length) answers 400 via the HTTP/1.0 proxy hop, `-d ''` gives 405; forwarded-header effect not yet observed; Sentry rules and first administrator still open.
## Defect on the first ASF test deploy: admin files 404 (U1 code)
**Timestamp**: 2026-11-08
**Found by**: Bryan (blank /admin), analysed with CMS & API.
**Root cause**: `MapCmsWebsiteNotFound` maps the catch-all `{*path}` without `nonfile`; routing selects it as endpoint for /admin/assets/x.css and the static-file middleware skips requests that already have an endpoint, so only the admin index (SPA fallback) worked. Existing tests only fetched /admin/. Reproduced locally by 4 failing tests first.
**Fix**: route constraint `notreserved` (`NotReservedPathConstraint`) on the catch-all so the reserved prefixes (/admin, /api/v1, /health) behave exactly as in SpaFallback mode (chosen over clearing/restoring the endpoint: simpler, covers future prefixes). Tests: admin index/css/js/favicon 200 with content types, /admin/dashboard SPA index, unknown admin asset 404 non-HTML, unknown /api/v1 empty 404, website /assets/missing.js still the 404 page. Open (pre-existing, not changed): admin inline theme-init script is blocked by CSP script-src 'self' (same on SlpSoftware); candidates: externalise the script or hash it in the admin policy.