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
Update MIME types associated to font extensions .ttf
, .woff
, .woff2
, and .otf
#2065
Conversation
.ttf
, .woff
and .woff2
Regarding |
@ioquatix - !ruby/object:MIME::Type
content-type: font/otf
encoding: base64
extensions:
- otf
xrefs:
rfc:
- rfc8081
template:
- font/otf
registered: true It also looks like |
To make (web)fonts support complete, what about |
I would be fine for I don't have any opinion about |
@davidstosik will you update the PR and add |
Sure! (By the way, |
.ttf
, .woff
and .woff2
.ttf
, .woff
, .woff2
, and .otf
@davidstosik Do you mind adding an entry to the changelog, thanks! |
a86ce01
to
c1f7339
Compare
c1f7339
to
ba9924c
Compare
Done! Am I supposed to add my GitHub handle, or is that reserved to maintainers? |
You can add it. |
What?
This PR updates the MIME types associated to font file extensions
.ttf
,.woff
,.woff2
, and.otf
to the more recent types prefixed withfont/
.Why?
Working on deploying a simple Rails application to Fly.io, I noticed that even though it was serving most of my assets gzipped (
content-encoding: gzip
), the TTF font that it serves was desperately uncompressed (and heavy!).It turns out that, as a precompiled asset, it gets served with the header
content-type: application/octet-stream
, and I believe this is due to Rack's MIME types.I believe this content-type might be excluded from getting gzipped by Fly.io's reverse proxy (and maybe other hosting solutions too?).
Looking into it, I noticed that
.woff
and.woff2
were using deprecated MIME types and decided to update them too.How?
Simply updated the values in Rack's hash that associates file extensions to MIME types.
Anything Else?
Resources on the IANA website:
font/woff
:font/woff2
:font/ttf
:Note that it might be worth revisiting the
.otf
too, but I was unable to find clear information about this extension. (font/otf
exists, but the.otf
extension is also associated withapplication/vnd.oasis.opendocument.formula-template
.)rack/lib/rack/mime.rb
Line 413 in b172805
For reference, I added this to my Rails application's
config/initializers/assets.rb
, as a temporary workaround: