Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion public/_headers
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down