Proper MIME type for .woff2 fonts
Today I updated Font Awesome package to 4.3.0 and noticed that woff2 font was added. That file is linked in CSS so I need to configure nginx to serve woff2 files properly.
Currently I have this block in nginx config for fonts:
location ~* .(otf|eot|woff|ttf)$ {
types {font/opentype otf;}
types {application/vnd.ms-fontobject eot;}
types {font/truetype ttf;}
types {application/font-woff woff;}
}
What is proper mime type for woff2 fonts?
In IIS you can declare the mime type for WOFF2 font files by adding the following to your project's web.config:
<system.webServer>
<staticContent>
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
</system.webServer>
Update : The mime type may be changing according to the latest W3C Editor's Draft WOFF2 spec. See Appendix A: Internet Media Type Registration section 6.5. WOFF 2.0 which states the latest proposed format is font/woff2
font/woff2
For nginx add the following to the mime.types
file:
font/woff2 woff2;
Old Answer
The mime type (sometime written as mimetype) for WOFF2 fonts has been proposed as application/font-woff2
.
Also, if you refer to the spec (http://dev.w3.org/webfonts/WOFF2/spec/) you will see that font/woff2
is being discussed. I suspect that the filal mime type for all fonts will eventually be the more logical font/*
( font/ttf
, font/woff2
etc)...
NB WOFF2 is still in 'Working Draft' status -- not yet adopted officially.
Apache
In Apache, you can add the woff2
mime type via your .htaccess
file as stated by this link.
AddType application/font-woff2 .woff2
IIS
In IIS, simply add the following mimeMap
tag into your web.config
file inside the staticContent
tag.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
链接地址: http://www.djcxy.com/p/8242.html
上一篇: 使用Meteor更改MIME类型
下一篇: 适用于.woff2字体的适当MIME类型