When I first announced Caddy in 2015 and the server got busy, it started downloading everything as .gz files. (facepalm) (good ol' days)
But that's just a fun story, not actually the reason we don't enable it by default...
The tricky thing about enabling features by default is that turning them off is awkward in config. And while we like to have "magic" in Caddy, we don't like too much magic. Plus, gzip performance in Go is less good (but more memory-safe) than it is in C and assembly. Klauspost's flate implementation is very fast and that's the one we use. But even with a super-fast implementation, gzip requires memory and CPU that busy servers may be in short supply of.
So it's opt-in for now. We can always change it later; going the other way is harder.
(Caddy also supports serving pre-compressed files, if enabled! And starting with Caddy 2.6, those can be teleported at the speed of electricity to HTTP clients using sendfile. HTTPS also sees faster file serving in 2.6 due to optimized copying.)
See also:
https://serverfault.com/questions/296770/why-arent-features-...
But it's obviously a trade-off and there's lots to weigh up...
Not high priority, but if Caddy would offer a report of things that aren't configured but perhaps should be...that could help. Things like Cache-control/Expires/Etag headers, Gzip/Deflate, Caching, and so on.
- An application uses compression
- An attacker is able to supply chosen data to it
- The application compresses the attacker's data and static secret data together
- The attacker is able to monitor the size of the compressed data
- This can be repeated by the attacker a number of times
will be vulnerable to having its secret data stolen by techniques like BREACH. If you want your secret data to stay secret, don't compress it with attacker chosen plaintext where the resulting size could be monitored.