IIS and WOFF2
A little tidbit I discovered today: IIS doesn't support the WOFF 2.0 web font format out-of-the-box. I discovered this after moving to self-host the Fira web fonts I use on this site. If you've not already tried Mario's excellent google-webfont-helper, go take a look. It takes the pain out of self-hosting Google web fonts.
Anyway, lack of support for WOFF2 in IIS is easily fixed by updating your
web.config to register the WOFF2 mime type:
<staticContent> <remove fileExtension=".woff2" /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> </staticContent>
The W3C recommends
application/font-woff2 as the correct mime type, so go with this.
You may have other entries in your
staticContent section. Be careful not to remove or alter them.
Seeing as you're self-hosting now, you probably also want to add some static file caching while you're at it:
<staticContent> <remove fileExtension=".woff2" /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> <clientCache cacheControlMaxAge="14.00:00:00" cacheControlMode="UseMaxAge"></clientCache> </staticContent>
This sets the
max-age header to 14 days. My site is using CloudFlare, which respects cache headers, so it's important to configure them to make use of its CDN.