Enable Compression
🚀 Installation & Setup
·
Updated 1 month ago
Setup
Via the UI
The toggle sits in the route wizard in Step 2 — Transport, next to Force HTTPS and Backend HTTPS.
- Create or edit a route
- In Step 2 enable the Compression toggle
- Save
There are no other options — Zstd, Brotli and Gzip are automatically active.
Via the API
# Enable Compression
curl -X PUT https://gatecontrol.example.com/api/v1/routes/1 \
-H "Authorization: Bearer gc_..." \
-H "Content-Type: application/json" \
-d '{
"compress_enabled": true
}'
Important notes
- Not recommended for already compressed content. Images (JPEG, PNG, WebP), videos (MP4, WebM), archives (ZIP, tar.gz) and fonts (WOFF2) are already compressed. Compression wastes CPU time and sometimes even grows them minimally.
- Caddy only compresses if the client sends
Accept-Encoding. Older or specialized HTTP clients without this header receive uncompressed responses. - Compression slightly increases CPU load on the GateControl server. With very high traffic and large responses, this can become relevant.
- Streaming responses (e.g. server-sent events, chunked transfer) are also compressed, but can have higher latency since the encoder waits for enough data to compress.
- Compression is only available for HTTP routes, not for L4 (TCP/UDP).
- If the backend itself already delivers compressed responses (
Content-Encoding: gzip), Caddy does not double-compress.
See also
- concepts/routing.md — Handler order in the HTTP pipeline