carlos / platform Public

docs: _headers for static sites

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev e2a049f1a2bca00dc1c930bca5e7c8feec8ba6e8 parent 5b21074
1 file changed, +50 −0
  • docs/site/cli.md +50 −0

CI failed — run details

Intent

Human

<cross-session-message from="uds:/run/user/1001/cc-socks/3901981.sock" from-name="platform-39" from-mode="bypass"> Release coordination: platform-39 plans to cut v0.31.0 from main tonight and roll it to dev and then flagship (Paul's go). It carries #447 regional domains, the static dir-slash fix, #114 named units and the fleet secrets key, which lands within the hour. Are you mid-release or mid-roll, or about to merge something that should wait for this cut or go into it? Reply "don't wait" or tell me what to wait for. </cross-session-message>

Human

<task-notification> <task-id>a6eeed4f85c032fd0</task-id> <tool-use-id>toolu_017uJxkh22ue9M6A6J8LpVst</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/0f246987-ca6b-4093-b104-f930443a8208/tasks/a6eeed4f85c032fd0.output</output-file> <status>completed</status> <summary>Agent "Implement Task 2: serve _headers" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE Commits: - `2939b9c9` edge: static sites serve _headers on 200/206/304 by request path; static routes leave the shared cache (#195, #450) - `5b210740` edge: one static _headers test fixture, shared by the golden and the serving tests Tests: the re-run passes all 11 tests. `testdata/static-headers-golden.json` is unchanged (`git diff --stat` listed only the two test files). `gofmt` and `go vet` are clean. Fix: there is now one fixture, `staticHeadersEdge`, in `static_headers_golden_test.go`. It returns the edge, the server and the tree directory. `headersEdge` just calls it. The golden test still uses no serving code, so it compiles at the base commit. No test assertion changed. Concerns: none new. The two minor points from the first report still stand: where the header writer is installed, and the one comment reworded outside the brief's list. Report (fix report appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/static-headers/.superpowers/sdd/2026-10-29-static-headers/task-2-report.md</result> <usage><subagent_tokens>128129</subagent_tokens><tool_uses>4</tool_uses><duration_ms>51798</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bxf0g0rjf</task-id> <tool-use-id>toolu_01VZoMquP96wjiZvyhmbbi6c</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/0f246987-ca6b-4093-b104-f930443a8208/tasks/bxf0g0rjf.output</output-file> <status>completed</status> <summary>Background command "Run the scoped Astra re-review of Task 2" completed (exit code 0)</summary> </task-notification>

diff --git a/docs/site/cli.md b/docs/site/cli.md
index 64091d7e1..e423dba27 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -425,6 +425,56 @@ Each page then has one address, and relative links in the page resolve
against its own folder. If the site's `_redirects` rules name that path, or
redirect its slash form, the folder is served at the path as asked instead.
+#### Response headers for a static site
+
+Put a file named `_headers` at the top of the site directory to set response
+headers on the paths you choose. It uses the format Netlify and Cloudflare
+Pages use: a path on a line of its own, then the headers for it, each on an
+indented line below it.
+
+```text
+# Released versions never change.
+/1.0.0/*
+ Cache-Control: public, max-age=31536000, immutable
+ Access-Control-Allow-Origin: *
+
+# The latest 1.x moves with each release.
+/1/*
+ Cache-Control: public, max-age=300
+ Access-Control-Allow-Origin: *
+```
+
+`Access-Control-Allow-Origin: *` lets pages on other sites fetch these
+files, load them as JavaScript modules and pin them with integrity hashes. A
+plain stylesheet or script tag works without it.
+
+- A path works as a `_redirects` source does. `:name` matches one segment, a
+ `*` at the end matches the rest of the path, and a URL with a host applies
+ only to requests for that host.
+- Rules match the address the browser asked for, before any `_redirects`
+ rewrite. If `/1/*` is rewritten to `/1.0.0/:splat`, a request for
+ `/1/site.css` gets the headers for `/1/*`.
+- Every rule that matches applies. When two set the same header, the one
+ lower in the file wins, so put general rules first and specific ones after
+ them.
+- Headers are sent with a file served normally, including its 304 and range
+ responses. Redirects, not-found pages and errors don't get them.
+- A `Cache-Control` rule replaces the `no-cache` every file gets by default.
+
+These headers can be set:
+
+| Header | Values |
+| --- | --- |
+| `Cache-Control` | any list of directives, such as `public, max-age=300` |
+| `Access-Control-Allow-Origin` | `*` |
+| `Access-Control-Expose-Headers` | a list of header names |
+| `Cross-Origin-Resource-Policy` | `same-origin`, `same-site` or `cross-origin` |
+| `Timing-Allow-Origin` | `*` |
+
+`carlos ship` and `carlos deploy` refuse a `_headers` file with a line they
+cannot use, and name the line. Any other header is refused too. A file can
+have up to 100 paths. The edge does not serve the `_headers` file itself.
+
#### Two builds at once
When a new build reaches an awake instance, it starts beside the old one,