Documentation
¶
Overview ¶
Package compress is the v1.11 phase 4 HTTP-compression middleware. Negotiates brotli (preferred) → gzip → identity from the request's Accept-Encoding header; sets `Vary: Accept-Encoding` so caches don't serve a brotli body to a gzip-only client.
Only compresses responses with a compressible Content-Type (text/*, application/json, application/javascript, image/svg+xml). Skips already-compressed media (PNG, JPEG, .min.js + .min.css served from /assets/ are explicit allowlist entries because Tailwind + htmx + Alpine ship as text/javascript without the .min marker).
Minimum body length: 1 KiB. Compressing 200-byte responses costs more CPU than it saves bandwidth.
SSE streams (`text/event-stream`) intentionally pass through unmodified — buffered compression breaks the event-flush semantics the v1.6 bus relies on.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.