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: trueIt 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.otfto 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
.woffand.woff2were 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
.otftoo, but I was unable to find clear information about this extension. (font/otfexists, but the.otfextension 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: