Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line isn't needed, WOFF is pre-compressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://community.cloudflare.com/t/cloudflare-is-missing-the-current-woff-media-type-in-the-default-compression-config/679095, this is beneficial if Brotli (and I guess Zstandard) are used.
Brotli isn't natively supported by Caddy, but FrankenPHP and https://github.com/dunglas/caddy-cbrotli allow us to easily add support for it. Zstandard is supported and is now on by default for Chrome and Firefox (not for Safari).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, but if WOFF1 is to be compressed then the matcher should be the standardized
font/woff
instead of or in addition to miscellaneous names it went by before being standardized.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I just copied the list maintained by Cloudflare: https://developers.cloudflare.com/speed/optimization/content/brotli/content-compression/#compression-between-cloudflare-and-website-visitors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also won't that wildcard on the end cause it to match WOFF2 anyway? AFAICT that wildcard is there in case the server appends a charset to the content type, but these are binary formats so that shouldn't happen.
For a second opinion, AWS and GCP don't compress either version of WOFF:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types
https://cloud.google.com/cdn/docs/dynamic-compression#compressible-content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true; I am not sure what would come after the
media/type
for binary types, and we could probably remove the wildcards (but that doesn't have to happen in this PR).So we don't "
woff
le" over this too much longer (hehe), maybe let's remove woff for now, since even the 1.0 was also compressed. I know that article linked by @dunglas recommends compressing woff too because of "additional savings" possible at the edge, but IMO that would be quite minimal and still expensive for marginal gains.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MIME type of WOFF2
font/woff2
, so it will not match, but I can remove this MIME type if you want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOFF removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks; hopefully that's the best decision, but I'm not really sure, but it sounds like there is no real consensus anyway. Both WOFF versions are compressed, even if WOFF2 has "better" compression; but I don't see a need to compress either of them.
Appreciate it!