Commit 575a992
authored
docs(cloudflare): explain edge compression and the agent.md gap (#195)
## Summary
Adds a **Response Compression** section to `docs/cloudflare.md` covering
two things an operator otherwise has to reverse-engineer:
1. why the Worker does not compress in the application (Cloudflare
compresses on egress, and `encodeBody` defaults to `"automatic"`, so an
application-compressed body gets encoded twice), while Node deployments
still do
2. that `/api/actions/:actionId/agent.md` is served uncompressed,
because Cloudflare's default compressible content types list
`text/x-markdown` but not the `text/markdown` this endpoint returns
## Why not just change the content type
`text/markdown` is the registered type from [RFC
7763](https://www.rfc-editor.org/rfc/rfc7763.html); `text/x-markdown` is
the pre-registration legacy spelling. Switching the response to the
legacy type purely to match one CDN's list would make the API less
correct for every deployment.
The payoff would also be small. Measured across all 11,181 actions in
the generated catalog:
| | raw | gzip |
|---|---|---|
| median agent guide | 1.5 KiB | — |
| mean | 1.8 KiB | — |
| largest (`alpha_vantage.get_technical_indicator`) | 19.9 KiB | 1.7 KiB
|
So the doc says what the behavior is and points at the Compression Rule
that changes it, and leaves the wire format alone.
## Depends on #193
The first paragraph describes the Worker leaving compression to the
edge, which is what #193 implements. **Merge after #193.** Until then
`main` still runs Hono's `compress()` on Workers, which is the bug #193
fixes.
## Validation
- `oxfmt --check .` clean
- docs-only change; no code, no tests affected1 parent 5fc9886 commit 575a992
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
156 | 175 | | |
157 | 176 | | |
158 | 177 | | |
| |||
0 commit comments