Tuesday, March 24, 2015

Set mime types for web fonts in IIS

A typical @font-face declaration includes a .eot file, a .svg file, a .ttf file and a .woff file. If your IIS does not serve any of the previous file types, you need to set the appropriate mime type.

Simply add the following MIME type declarations via IIS Manager (HTTP Headers tab of website properties):
.eot   application/vnd.ms-fontobject
.ttf   application/octet-stream
.svg   image/svg+xml
.woff  application/font-woff
If you do not have access to the IIS Manager, you can add these declarations in your Web.config file, in the <system.webServer> section.
<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
        <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
        <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    </staticContent>
</system.webServer>

No comments:

Post a Comment