From 7d6cc5b0bff131ba662f445e7f362f3381346931 Mon Sep 17 00:00:00 2001 From: stroblme Date: Wed, 7 Oct 2026 09:32:06 +0200 Subject: [PATCH] Serve index.html no-cache on every route; check the theme script's CSP hash `try_files` served the SPA fallback inside `location /`, so `/` and every client route went out without `Cache-Control: no-cache`. The fallback is now the last argument, an internal redirect to the exact no-cache location. `src/csp.check.ts` recomputes the inline theme script's sha256 and fails `bun run check` with the new value when the CSP no longer names it. --- frontend/nginx-security-headers.conf | 3 ++- frontend/nginx.conf | 5 ++++- frontend/src/csp.check.ts | 33 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 frontend/src/csp.check.ts diff --git a/frontend/nginx-security-headers.conf b/frontend/nginx-security-headers.conf index 2684c91..596a682 100644 --- a/frontend/nginx-security-headers.conf +++ b/frontend/nginx-security-headers.conf @@ -3,7 +3,8 @@ # # script-src: the bundle, plus the theme script inline in index.html by its # hash. Edit that script and this hash must change with it (sha256 of the text -# between the tags, base64), or the app paints light-then-dark again. +# between the tags, base64), or the app paints light-then-dark again; +# `bun run check` (src/csp.check.ts) fails with the new value. # style-src 'unsafe-inline': Monaco, Radix's scroll lock and the toasts insert #