Repository: caddyserver/caddy (language: go)

Issue:
"Encode" defaults compress already compressed font formats
The default matcher for `encode` currently includes `font/*`, matching every font format. However, the modern WOFF and WOFF2 web font formats are already internally compressed with zlib and brotli respectively, so compressing them again is likely a waste of CPU cycles. Would it make sense to refine the defaults down to only compress the "legacy" non-WOFF formats?

https://www.iana.org/assignments/media-types/media-types.xhtml#font


Discussion / hints:
Hmm, we used to do that: https://github.com/caddyserver/caddy/commit/d3f23a8eeb3b0b7198ae4c06879227b467fcfaa6

@dunglas what do you think?
I agree. We should exclude these ones.
I believe the formats supported by browsers pre-WOFF were TTF, OTF, EOT and SVG, with these MIME types:

```
font/ttf
font/otf
application/vnd.ms-fontobject (EOT)
image/svg+xml (SVG fonts don't appear to have a more specific MIME type)
```

Caddy already has specific matchers for EOT and SVG so I think it would only need `font/ttf` and `font/otf` to be added in lieu of `font/*`. 

Fix patch:
diff --git a/modules/caddyhttp/encode/encode.go b/modules/caddyhttp/encode/encode.go
index 908e37b359f..cf3d17b6948 100644
--- a/modules/caddyhttp/encode/encode.go
+++ b/modules/caddyhttp/encode/encode.go
@@ -112,7 +112,8 @@ func (enc *Encode) Provision(ctx caddy.Context) error {
 					"application/x-ttf*",
 					"application/xhtml+xml*",
 					"application/xml*",
-					"font/*",
+					"font/ttf*",
+					"font/otf*",
 					"image/svg+xml*",
 					"image/vnd.microsoft.icon*",
 					"image/x-icon*",


Test patch: