I've just starting using Azure Web Sites to publish certain sites. I've also recently braved using web fonts from certain providers.
After publishing my site today, I noticed when I ran it, that the WOFF font type was returning a 404 error:
After treble checking my settings in Visual Studio 2013, the file was definitely there and not excluded from the project:
It turns out that the problem is actually caused by Azure, not by anything we've done wrong! Azure doesn't actually have a MIME type configured for WOFF files, so simply returns 404 (surely there would be a better HTTP Error number for this?!?).
The fix is really simple. Head to the web.config file and add a <staticContent> into the <configuration> element:
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
Once that's in, Azure correctly delivers our WOFF files:Once that's in, Azure correctly delivers our WOFF files:
Última atualização: 14/11/2017 às 16:18
Confirma a exclusão deste comentário?
Deseja remover essa dica dos seus favoritos?