Error retrieving glyphicons-halflings-regular.woff2 on successful AJAX call from jQuery
Solution 1:
Using IIS I fixed it inside the Web.config-file, add the following inside <system.webServer>
:
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
</staticContent>
Notice I remove the extensions first, in case they already exist.
Solution 2:
To get it to work with IIS Express you need to add the mime type. In a text editor open the file in your Documents folder at %UserProfile%\Documents\IISExpress\config\applicationhost.config
Search for a line that looks like this:
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
I would recommend changing it as the official MIME type has changed, but regardless simply copy that line and add a new one and change the fileExtension to .woff2 in the new one. Here is my modified file (with the corrected MIME types)
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
Solution 3:
If you prefer to work in the IIS GUI or aren't comfortable with command line or config files, follow the steps below.
To resolve the error retrieving glyphicons-halflings-regular.woff2 in IIS, you just need to add a MIME type for woff2.
- Open IIS and Select your server
- In the Features View, select MIME Types
- Click Add... in the Actions pane (top-right corner)
- Enter the File name extension of .woff2
- Enter the MIME type of application/font-woff
Also, as palehorse noted, ensure the MIME type for both .woff and .woff2 are application/font-woff
Sources:
- TechNet - Add a MIME Type (IIS 7) Tutorial
- W3 - Official MIME Media Type Registration