4.6 KiB
4.6 KiB
Hand-back U1 - core-site-hosting
Branch feature/andreaslop-site-hosting (2 local commits, not pushed). Code summary: construction/core-site-hosting/code/code-summary.md.
1. What was built
CmsHostOptions.WebsiteMode(SpaFallbackdefault,PrerenderedPages); existing clients unchanged.- Pure
WebsitePathResolver(rules R1-R14),PrerenderedSiteMiddleware, final 404 fallback, gzip-only compression,Website:NoIndex(X-Robots-Tag + robots.txt),WebsiteFileAccess(per-request file lookup, no cache, no restart after delivery). StrictSitepolicy withSecurityHeaders:AllowedSiteScriptOrigins/AllowedSiteConnectOrigins(used only by StrictSite); CSP is byte-identical to the nginx value (asserted in a test with the Umami and Sentry origins).- Full header set on every website response (page, asset, 301, 404, robots.txt) via a flag on the security-header writer; API and admin keep the HTML-only rule.
- Docs:
WEBSITE_WORKSPACE.md,README.md.
Deviations from the brief (reasons in code-summary.md): none in behaviour. Behaviour choices you reviewed: R11 nginx parity (301 on every trailing slash), dot segments refused except /.well-known/, full headers everywhere, gzip only, logging category SlpModularCms.Website.
Behaviour notes for the verify script: 405 (Allow: GET, HEAD) for non-GET/HEAD on non-reserved paths that no endpoint claims; HEAD is supported; Location is always relative; /404 and /404.html answer the 404 page with status 404; a directory without a page file is 404; unknown /api/v1/... is an empty API 404.
2. Test results
- Build: success.
Core.Tests: 330 passed (resolver examples, FsCheck properties, StrictSite policy, 25 in-memory integration scenarios).Modules.Identity.Tests37,Master57,Offerings57,Availability82: all passed. - Property-based: FsCheck.Xunit 3.4.0 (test-only), 2000 generated paths per property, a new random seed each run; a failure prints the replay seed and the shrunk counterexample, which is then pinned as a plain example test (PBT-08). Properties: resolver never throws, ServeFile paths safe and existing, Redirect targets relative and never ending in
/(except/), a redirect target never redirects again, reserved prefixes never resolved, at most 2 file checks; CSP origin round trip. - Regression
Api/Api.SlpSoftware:Api.Tests(the only host test project; SlpSoftware has none) could not run here: it needs a reachable MariaDB and failed with socket errors at the startup migration. Not a code failure, but also not proven green.ApiandApi.SlpSoftwarebuild, default toSpaFallback, and a SpaFallback-mode integration test shows unchanged behaviour. Please runApi.Testswhere a database exists (or I run it on the Pi in U2). - Local timing: 500
GET /over-mijon an in-memory server = 0.72 ms per request (not a Pi measurement).
3. Configuration values for the website repo
- Client opt-in:
new CmsHostOptions { WebsiteMode = WebsiteMode.PrerenderedPages }(done in U2 inApi.AndreaSlopFotografie). SecurityHeaders:DefaultPolicy = StrictSite;AllowedSiteScriptOrigins = [https://analytics.slpsoftware.nl];AllowedSiteConnectOrigins = [https://analytics.slpsoftware.nl, https://o4511795618185216.ingest.de.sentry.io].Website:NoIndex = trueon test.- Headers sent on every website response: CSP (exact nginx string),
Strict-Transport-Security: max-age=31536000; includeSubDomains(not in Development),X-Content-Type-Options: nosniff,X-Frame-Options: DENY,Referrer-Policy: strict-origin-when-cross-origin; plusX-Robots-Tag: noindex, nofollowwhen NoIndex. - Cache-Control:
no-cachefor pages/root files,public, max-age=31536000, immutableunder/assets/. HTML content typetext/html; charset=utf-8. - Delivery path:
wwwroot/web/of the published app (U2 decides whether CI writes there or a symlink to/mnt/storage1/www/html/...; both work without restart). Hostname, ports (5200 test) and the test deploy come with U2. - Logging:
Logging:LogLevel:SlpModularCms.Website = Informationon test (301/404 lines), Warning elsewhere.
4. Open questions and risks
Api.Testsnot run (no database); see section 2.- HSTS is not sent when the host runs in
Development; irrelevant on the Pi, relevant for local verify runs. - Behind the proxy Pi the host sees plain HTTP; redirects are relative and
UseHttpsRedirectionstays a no-op, covered by a test, not yet observed on the Pi. - No forwarded-headers handling was added; nothing in U1 needs the original scheme or host.
- Per-request file lookup is not measured on the Pi SD card /
/mnt/storage1; I expect it to be fine, a measurement can follow in U2.