Blaise
Blaise

Reputation: 22232

How to correctly add a font Mime map in Web.config

Other posts in SO suggested me adding

<mimeMap fileExtension=".woff" mimeType="application/x-woff" />

or

<mimeMap fileExtension=".woff" mimeType="application/woff" />

for the font-awesome icons.

But after I have

<system.webServer>    
<staticContent>
  <mimeMap fileExtension=".woff" mimeType="application/woff" />
</staticContent>
</system.webServer>

I found all my other static resources cannot be loaded. My browser console points out all the GET for .js, .css, .png, etc ended with a 500 Internal Server Error.

So how can I just add one mime type without remove all other existing mime maps?

Upvotes: 0

Views: 2100

Answers (2)

Blaise
Blaise

Reputation: 22232

Just found the solution here.

Since we cannot have duplicate mimemap, I need to add a remove.

<system.webServer>    
<staticContent>
  <remove fileExtension=".woff"/>
  <mimeMap fileExtension=".woff" mimeType="application/woff" />
</staticContent>
</system.webServer>

And I find both application/woff and application/x-woff will work.

Upvotes: 1

Colin Bacon
Colin Bacon

Reputation: 15619

This works fine for me.

<staticContent>
  <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>

Upvotes: 0

Related Questions