Commit graph sonda/internal/api/http/web_test.go
Author SHA1 Message Date
tgiachi
7acac73dd0 feat(api): serve the web app on / and for its own links, with a strict policy
A GET or HEAD outside /api is a file of the app, or its page for a link inside it (/admin/users). A file that is missing (under assets/ or with an extension) answers 404, never the page, so a missing script is not run as HTML; hidden files and folders are never served; everything else, and any unknown /api address, keeps the JSON 404. The page gets a Content-Security-Policy that allows only its own server (no address, no wildcard, no inline script), nosniff, DENY and no referrer. Hashed assets are cached for good and the page is asked again. With no app in the binary, / says how to build it. The app is an optional dependency, so existing wiring is unchanged.
2026-11-12 15:56:33 +01:00