- What happened
- The script that sets the colour theme ran with an empty nonce, so the browser blocked it on every page and dark mode flashed light on load. CSP violation reports never arrived either.
- Cause
- The middleware wrapped the i18n middleware's response in a second one, which overwrote the list of forwarded request headers, so the nonce never reached the page. Separately, the report endpoint sat under /api, which the ingress sends to fsn-api.
- Fix
- The nonce is now set on the request before the i18n middleware runs, and reports go to /csp-report (PR #49). A unit test checks that the nonce reaches the page.
- What changed
- A security header can fail without any visible error. It needs a test, and a look at the live page after deploy.