Fontawesome does not work when servicing IIS

FontAwesome does not work for me when I put my application on an IIS7 server.

In Firefox, the requested URL is encoded before http://l2etest.kema.intra/fonts/fontawesome-webfont.ttf%3Fv=4.0.3, and I get 404. When I change %3Fto ?, everything works fine.

The same thing happens in IE, but the request extends to the eot font.

This is what I have in CSS (same as on the FontAwesome page):

@font-face {
  font-family: 'FontAwesome';
  src: url('../fonts/fontawesome-webfont.eot?');
  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

I think the problem is that IIS encodes the URLs and the ../fonts/fontawesome-webfont.eot?request is sent instead of the request ../fonts/fontawesome-webfont.eot%3F.

Please do not suggest deleting the '?' or '#' from urls. They are on purpose and necessary. The question is how to make IIS not encode URLs this way. Any clues would be appreciated.

Edit: Btw. , web.config requestValidationMode requestPathInvalidCharacters:

<httpRuntime shutdownTimeout="360" maxRequestLength="102400" enable="true" requestValidationMode="2.0" requestPathInvalidCharacters="" />

400 ( ): Request.Path (?)

IIS ?

Edit2: , . SquishIt MVC3 . font-awesome.css , .

+4
8

SquishIt MVC3 url- , ../fonts/fontawesome-webfont.eot? css ../fonts/fontawesome-webfont.eot%3F. 400, % 3F . requestPathInvalidCharacters="", % 3F , , , ``../fonts/fontawesome-webfont.eot% 3F`, 404.

fontawesome.css , .

+3

@font-face 404 Woff ?

MIME -:

  <system.webServer>
    <staticContent>
      <remove fileExtension=".woff" /> <!-- In case IIS already has this mime type -->
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
    </staticContent>    
  </system.webServer>
+19

IIS, , IIS, MIME Types. Mime Types β†’ :

  • : .woff
  • MiME: /x -font-woff

"".

.

+4

. , , .

, , IIS awoff , MyIpAddress/fonts/fontawesome-webfont.woof, . fontawesome-webfont.eot, fontawesome-webfont.svg,fontawesome-webfont.ttf, fontawesome-webfont.woff

+2

CDN bootstrap

:

<head>
...
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
...
</head>
+2

IIS sever , , 100% .

1

, .jpg .

fontawesome-webfont.eot.jpg()

fontawesome.css

 */@font-face{font-family:'FontAwesome'; src:url('../fonts/fontawesome-webfont.eot.jpg?v=4.0.3'); src:url('../fonts/fontawesome-webfont.eot.jpg?#iefix&v=4.0.3') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff.jpg?v=4.0.3') format('woff'),url('../fonts/fontawesome-webfont.ttf.jpg?v=4.0.3') format('truetype'),url('../fonts/fontawesome-webfont.svg.jpg?v=4.0.3#fontawesomeregular') format('svg');
+1

CodeIgniter IIS7:

In the web.config file add woff to the template

<rule name="Rewrite CI Index"> <match url=".*" /> <conditions> <add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html|woff" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule>

Hope this helps!

+1
source

I switched from woff2 to woff, and everything went fine.

0
source

Source: https://habr.com/ru/post/1536061/


All Articles