Skip to content

Commit

Permalink
fix: add more media types to the compressed by default list
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Feb 9, 2024
1 parent e1aa862 commit b8f729b
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions modules/caddyhttp/encode/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,59 @@ func (enc *Encode) Provision(ctx caddy.Context) error {

if enc.Matcher == nil {
// common text-based content types
// list based on https://developers.cloudflare.com/speed/optimization/content/brotli/content-compression/#compression-between-cloudflare-and-website-visitors
// with application/atom+rss added
enc.Matcher = &caddyhttp.ResponseMatcher{
Headers: http.Header{
"Content-Type": []string{
"text/*",
"application/json*",
"application/javascript*",
"application/xhtml+xml*",
"application/atom+xml*",
"application/eot*",
"application/font*",
"application/font-sfnt*",
"application/font-woff*",
"application/geo+json*",
"application/graphql+json*",
"application/javascript*",
"application/javascript-binast*",
"application/json*",
"application/ld+json*",
"application/manifest+json*",
"application/opentype*",
"application/otf*",
"application/rss+xml*",
"application/truetype*",
"application/ttf*",
"application/vnd.api+json*",
"application/vnd.ms-fontobject*",
"application/wasm*",
"application/x-httpd-cgi*",
"application/x-javascript*",
"application/x-opentype*",
"application/x-otf*",
"application/x-perl*",
"application/x-protobuf*",
"application/x-ttf*",
"application/xhtml+xml*",
"application/xml*",
"font/otf*",
"font/ttf*",
"font/x-woff*",
"image/svg+xml*",
"image/vnd.microsoft.icon*",
"image/x-icon*",
"multipart/bag*",
"multipart/mixed*",
"text/css*",
"text/javascript*",
"text/js*",
"text/plain*",
"text/richtext*",
"text/x-component*",
"text/x-java-source*",
"text/x-markdown*",
"text/x-script*",
"text/xml*",
"text/html*",
},
},
}
Expand Down

0 comments on commit b8f729b

Please sign in to comment.