diff --git a/AGENTS.md b/AGENTS.md index 9c19b14..fbffe58 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,7 +17,7 @@ Josselin Perrus's personal site: an Astro 7 static site served by Cloudflare Wor - `docs/document-sharing.md`: how the encrypted portfolio links on `/documents/` work and how to create them. - `wrangler.jsonc`: the Cloudflare Worker `meaningfool`, which serves `dist/` as static assets. - `worker/index.js`: the only Worker code. It answers byte-range requests for the videos in `/images/`, which Safari needs to play them. -- `public/_headers`: headers Cloudflare adds to responses: security headers, a year of caching for the fingerprinted `/_astro/*` files, and a Content-Security-Policy in report-only mode. A new kind of outside resource, such as another video host's embed or a third-party script, must be added to that policy. The build also writes `dist/_redirects`, the permanent `/page` → `/page/` redirects, with `src/lib/trailing-slash-redirects.mjs`. +- `public/_headers`: headers Cloudflare adds to responses: security headers, a day of caching for the fingerprinted `/_astro/*` files (a day, not a year, because their 404s get the same header), and a Content-Security-Policy in report-only mode. A new kind of outside resource, such as another video host's embed or a third-party script, must be added to that policy. The build also writes `dist/_redirects`, the permanent `/page` → `/page/` redirects, with `src/lib/trailing-slash-redirects.mjs`. ## Commands diff --git a/public/_headers b/public/_headers index 74f643e..e932dfa 100644 --- a/public/_headers +++ b/public/_headers @@ -13,8 +13,13 @@ Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline'; font-src 'self'; img-src 'self' data: https:; media-src 'self'; frame-src https://www.youtube.com https://www.youtube-nocookie.com; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none' # Fingerprinted build files: their names change whenever their content does. +# Browsers keep them for a day, not a year, because Cloudflare sends the same +# header with the 404 for a missing file. In the seconds after a deploy, a new +# page can ask for its new files from a server still on the previous version, +# and the browser would keep that 404 as long as a real file. Without immutable, +# reloading the page in Firefox or Safari checks them again. /_astro/* - Cache-Control: public, max-age=31536000, immutable + Cache-Control: public, max-age=86400 # Cloudflare sends text files as plain text/plain, and browsers then decode the # emoji and accents in llms-full.txt as Windows-1252, so add the charset.