We serve some web fonts (.woff) from our static assets and I would like to set the correct mime type (application/x-font-woff). I tried to do this in config/initializers/mime_types.rb but it had no effect:
Mime::Type.register "application/x-font-woff", :woff
The returned mime type still stayed application/octet-stream. I even tried to add this line (because it was the only other place in the rails source where I could find the string "woff"):
Rack::Mime::MIME_TYPES[".woff"] = "application/x-font-woff"
But it still didn’t help. How do I properly set the mime type for web fonts?
Until Rack fixes its MIME-type list to a correct
woff, the interim hack is indeed yourconfig/initializers/mime_types.rbline:To have it actually take effect, though, you have to wipe
tmp/cacheand restart your server.