Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Encode" defaults compress already compressed font formats #6428

Closed
jsheard opened this issue Jul 1, 2024 · 4 comments · Fixed by #6432
Closed

"Encode" defaults compress already compressed font formats #6428

jsheard opened this issue Jul 1, 2024 · 4 comments · Fixed by #6432
Labels
bug 🐞 Something isn't working

Comments

@jsheard
Copy link

jsheard commented Jul 1, 2024

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

@mholt
Copy link
Member

mholt commented Jul 1, 2024

Hmm, we used to do that: d3f23a8

@dunglas what do you think?

@dunglas
Copy link
Collaborator

dunglas commented Jul 1, 2024

I agree. We should exclude these ones.

@jsheard
Copy link
Author

jsheard commented Jul 2, 2024

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/*.

@dunglas
Copy link
Collaborator

dunglas commented Jul 3, 2024

I opened #6432 to fix the issue. Would you mind double-checking the patch @jsheard?

@mholt mholt added the bug 🐞 Something isn't working label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants