# Security headers for every static response Cloudflare serves. Workers
# reads this file out of the asset directory; Astro copies public/ into
# dist/ verbatim, so this is where it is authored. Format and limits:
# developers.cloudflare.com/workers/static-assets/headers/
#
# Mirrors daemon-sec's staticSecurityHeaders() with the differences this
# site needs: 'wasm-unsafe-eval' and a same-origin worker for the Pagefind
# search index, and data: fonts for the icon face inlined in the CSS. No
# script, style or font is loaded from another origin.
#
# Inline scripts (the theme and page-iris bootstraps, and the modules
# Astro inlines) are allowed by hash, not by 'unsafe-inline'. The
# placeholder below is filled by scripts/csp-hashes.mjs at the end of
# `npm run build`, so this file is a template: the served copy is
# dist/_headers. Styles keep 'unsafe-inline' because Astro emits style
# attributes, which no hash can cover.
# img-src is open to https: because the imported sheets hotlink figures from
# dozens of hosts; frame-src 'self' is for the PDF viewer on the JJ guide.
/*
Content-Security-Policy: default-src 'self'; base-uri 'self'; form-action 'self'; script-src 'self' __INLINE_SCRIPT_HASHES__ 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' http://127.0.0.1:47631; font-src 'self' data:; object-src 'none'; media-src 'self'; frame-src 'self'; frame-ancestors 'none'; worker-src 'self'; upgrade-insecure-requests
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Cross-Origin-Opener-Policy: same-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
Permissions-Policy: camera=(), microphone=(), geolocation=(), browsing-topics=()
X-DNS-Prefetch-Control: off
X-Permitted-Cross-Domain-Policies: none
# The JJ field guide page frames its own PDF. The response for the PDF
# itself must allow that, or the viewer shows nothing: frame-ancestors is
# judged on the framed document, not the page framing it. A PDF runs no
# script, so everything else stays closed.
/pdfs/*
! X-Frame-Options
! Content-Security-Policy
Content-Security-Policy: default-src 'none'; frame-ancestors 'self'