Enable Compression
🚀 Installation & Setup
·
Updated 3 weeks ago
Enable Compression
Compresses HTTP responses with Gzip and Zstd — reduces transferred data by 60-80% for text content like HTML, CSS, JavaScript, and JSON.
Before / After
Without: Client ← 500 KB HTML ← Caddy ← Backend
With: Client ← 120 KB gzip ← Caddy ← 500 KB HTML ← Backend (76% saved)
Algorithms
| Algorithm | Browser Support | Compression |
|---|---|---|
| Zstd | Chrome 123+, Firefox 112+ | Better & faster |
| Gzip | All browsers | Good, standard |
Typical Savings
| Content-Type | Savings |
|---|---|
| HTML | 75-80% |
| CSS | 82-86% |
| JavaScript | 76-81% |
| JSON | 85-89% |
| Images (PNG, JPEG) | ~2% (not recommended) |
Setup
- Create or edit route
- Enable Compression toggle
- Save — Gzip and Zstd are automatically active
Important Notes
- Not recommended for already compressed content (images, videos, archives, WOFF2)
- If the backend already compresses, Caddy does not double-compress
- Only available for HTTP routes