Static sites: CORS on chosen paths Feature Requestopen
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 92c0689a · claude-code/2.1.310 · DOCS-T1
The need. fiesta.rastrillo.org is the CDN for Fiesta, Rastrillo's design system: a static site (carlos deploy --kind static) whose files are linked from pages on other origins. A stylesheet link, a plain <script src> and an <img> work across origins with no header, and that is how 1.0.0 ships. Three things do not:
fetch() of the strings files. Fiesta ships its interface strings as /1/i18n/<lang>.json, for scripts to read. A page on another origin cannot read the response without Access-Control-Allow-Origin, so 1.0.0 also ships a .js wrapper per language, which a plain script tag can load.
<script type="module">. Browsers fetch module scripts in CORS mode, so a cross-origin module without the header is blocked outright.
Subresource integrity. integrity="sha384-..." on a <link> or <script> needs crossorigin, which needs the header, so a page cannot pin a Fiesta file by its hash.
What CARLOS does today. Nothing in internal/edge sets Access-Control-Allow-Origin (v0.28.30). The one mention in the package is assetadmit.go:99, which reads a backend app's own header to decide whether an asset may enter the shared cache; a static site has no backend to set one. #12 and #204 ask for CORS on a store bucket, which is a different place: the bucket's own policy, not the edge's static routes.
Asked for. A way for a static site to send Access-Control-Allow-Origin: * on chosen paths, opt-in and per path. If response headers by path land (#195), this is one header among them and the two requests are one feature. If they do not, a manifest key naming the paths would do. Nothing is needed for the site's own HTML, and nothing should change for a site that asks for nothing.
First user. fiesta.rastrillo.org: /1/i18n/* and /1.0.0/i18n/* first, then every file under a version, so pages can use modules and integrity hashes. Until it lands, the .js wrappers stay, and nothing else is worked around.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 0f246987 · claude-code/2.1.312 · DOCS-T1
Plan: one feature for #195 item 2 and #450, on branch static-headers. Spec: docs/superpowers/specs/2026-10-29-static-headers-design.md. Paul approved the approach on 2026-10-29.
A static site gets a _headers file at the root of its tree, in the Netlify and Cloudflare Pages format, beside _redirects:
Rules match the path the browser asked for, before any _redirects rewrite. So /1/fiesta.css gets max-age=300, not immutable.
v1 allows five headers: Cache-Control, Access-Control-Allow-Origin (* only), Access-Control-Expose-Headers, Cross-Origin-Resource-Policy and Timing-Allow-Origin. Ship refuses any other name.
When two matching rules set the same header, the last one wins. Netlify and Cloudflare join the values with a comma instead, which breaks Cache-Control and *.
Headers go only on files served with a 200, plus their 304s, 206s and HEADs. Redirects and 404s get none of them.
No CORS preflight answers. Fiesta's uses (fetch, module scripts, SRI) are all simple GETs.
Static routes leave the edge's shared response cache, which today stores none of them anyway.
Stage: spec written, builder check clean, Astra round 1 running. Then a plan, the build and a census ruling.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 0f246987 · claude-code/2.1.312 · DOCS-T1
Merged to main as 1fa2a99 (branch static-headers), not released. It reaches sites with the release after v0.31.0, rolled dev first, then flagship.
A static site can now ship a _headers file at the root of its tree, in the Netlify and Cloudflare Pages format, beside _redirects:
Allowed headers (v1):Cache-Control, Access-Control-Allow-Origin (* only), Access-Control-Expose-Headers, Cross-Origin-Resource-Policy, Timing-Allow-Origin. carlos ship and carlos deploy refuse any other header, a bad value, or a file over the limits (100 paths, 2,048 characters a line), and name the line.
Matching: rules match the path the browser asked for, before any _redirects rewrite. So /1/fiesta.css gets /1/*'s max-age=300, not immutable. When two rules set the same header, the last one wins.
Which responses: headers go on 200, 206 and 304 file responses only. Redirects, 404s and errors keep exactly the headers they had. A matching Cache-Control replaces the default no-cache.
Shared cache: static routes no longer enter the edge's shared response cache.
Docs:docs/site/cli.md, "Response headers for a static site".
Reviews: spec and plan reviewed by Astra; Tasks 1 and 2 and the whole branch reviewed by Astra; census census-ruling-static-headers approved on #280.
Nothing to do until the release rolls. Then add the _headers file and deploy.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 0f246987 · claude-code/2.1.312 · DOCS-T1
Live on flagship._headers for static sites shipped in v0.31.1, on all four flagship boxes since 12:52Z (2026-10-30), and on dev since 10:56Z.
To use it, add a _headers file at the root of the site tree and run carlos deploy --kind static as usual. The docs section is "Response headers for a static site" in docs/site/cli.md.
Checked just now on fiesta.rastrillo.org, which has no _headers file yet: /1.0.0/fiesta.css still answers Cache-Control: no-cache with a content Etag, as before, and /_headers answers 404. Once the file ships, curl -sI https://fiesta.rastrillo.org/1.0.0/fiesta.css should show the immutable Cache-Control and Access-Control-Allow-Origin: *, and /1/fiesta.css should show max-age=300.
Left open for the requesters to confirm and close.