51

Summary

I'm running into an issue using @font-face over HTTPS in IE 7,8,9 - it simply is not loading. It does not matter whether the containing HTML page is hosted on HTTPS or not, when I try to load the EOT font over HTTP it works, HTTPS it doesn't. Has anyone seen this behavior?

The server hosting the font is sending the proper content-type="application/vnd.ms-fontobject"

I've tried multiple fonts, so it's not specific to the font.

The fonts were generated over at Font Squirrel

CSS Syntax

@font-face {
font-family: 'GothamCondensedBold';
src:url('path/to/fontgothmbcd-webfont.eot');
src:url('path/to/fontgothmbcd-webfont.eot?#iefix') format('embedded-opentype'),
    url('path/to/fontgothmbcd-webfont.woff') format('woff'),
    url('path/to/fontgothmbcd-webfont.ttf') format('truetype'),
    url('path/to/fontgothmbcd-webfont.svg#GothamCondensedBold') format('svg');
font-weight: normal;
font-style: normal;
}

Sample Page

http://gregnettles.net/dev/font-face-test.html

Greg
  • 561
  • 1
  • 4
  • 8
  • 1
    This is strange (IE9).. copy your HTML to http://jsbin.com/, hit "Save", click the generated link. Both fonts work.. until you hit refresh. – thirtydot Oct 13 '11 at 00:57
  • 1
    **Update** LDG pointed out (below) that the issue could be the SSL certificate not matching the origin domain. This may explain why the HTTP request works but hot HTTPS. I'll look into this and post back with findings. – Greg Oct 13 '11 at 19:33
  • **Update** Bummer. Turns out the SSL cert wasn't the issue. Though, on my test page the SSL cert is a mismatch, this is not the case for the actual site I'm trying to get this working on, the domain of which IS on the SSL cert. – Greg Oct 13 '11 at 19:43
  • Same issue here, anything on the result? – Joshua - Pendo Jun 22 '12 at 17:10
  • 1
    I have the same issue in IE8 - font-face over http works, https doesn't, and it only fails on first page load, after that the font shows as expected (see http://stackoverflow.com/questions/7034068/font-face-does-not-work-in-ie-on-initial-page-load-but-does-after-that). I installed Fiddler and inspected traffic. It looks like the EOT file comes across the wire just fine, with Content-Type: application/vnd.ms-fontobject . Could it simply be an IE8 rendering bug, and we're up a creek? Man I hope that's not the case :/ – siliconrockstar Oct 11 '12 at 18:20
  • Running across this same issue now with our Apache server and IE9. Any further solution or tips? – Voodoo Sep 30 '13 at 21:08
  • Try removing the cache: no-cache header see my answer below. – refactorthis Jan 29 '14 at 05:38
  • Probably related to this bug report: https://connect.microsoft.com/IE/feedbackdetail/view/992569/font-face-not-working-with-internet-explorer-and-http-header-pragma-no-cache – dagnelies Nov 04 '15 at 12:06

18 Answers18

42

I ran into this problem with HTTPS, but not HTTP. For some reason IE would continue through the different font options, ignoring 200 OK responses.

In my case, the problem was the HTTP header Cache-Control: no-cache for the font. While this will work fine with HTTP, over HTTPS it causes Internet Explorer to ignore the downloaded font.

My best guess is that it's a variation of this behaviour:

KB 815313 - Prevent caching when you download active documents over SSL (archive)

So, if you're seeing IE work through each font in the Developer Tools network view, it might be worth checking if you have a Cache-Control header and removing it.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
tjdett
  • 1,703
  • 1
  • 18
  • 23
  • Using Apache, I added `SetEnvIfNoCase Request_URI \.eot$ FONT` and don't set the Cache-Control header if the `FONT` environment variable exists (`env=!FONT` in the `Header` directive). – Steve Rice Nov 02 '13 at 00:21
  • 3
    This just solved my problem w/ IE8 / SSL / IIS 8.0 - thank you. – Chief Jan 30 '14 at 20:32
  • Yes! We chased so many other red herrings, this turned out to be our issue as well. Thank you! – phil Jun 04 '14 at 00:13
  • 3
    In my case, I also needed to remove `Pragma: no-cache` – ChristophK Jul 11 '14 at 08:48
  • +1 for this answer. rm'ing Cache-Control: no-cache, no-store and Pragma: no-cache fixed a persistent issue for us where the web font showed in everything (even IE9 in VirtualBox) except for IE9 over Citrix. – lyyons Nov 13 '14 at 19:13
  • have a node server using font-awesome worked in everything except ie9. Read your reply and tried removing the Cache-Control and it worked!!! Thank-you very much! – Thibs Jan 06 '15 at 21:03
  • If the answer still doesnt help! try this [answer above](http://stackoverflow.com/questions/7748140/font-face-eot-not-loading-over-https#answer-29383741). – ProgramCpp Sep 16 '15 at 09:37
  • Same problem here, had to remove Cache-Control and Pragma headers for *.woff files. – Haukur Kristinsson Oct 08 '15 at 17:30
  • This is THE answer. Worked on my IE11 + IIS8 config by removing the no-cache headers I was passing. What a stupid bug...I can't wait until the day IE is finally gone for good. – Concept211 Oct 28 '15 at 17:47
  • 1
    Here is a bug report: https://connect.microsoft.com/IE/feedbackdetail/view/992569/font-face-not-working-with-internet-explorer-and-http-header-pragma-no-cache – dagnelies Nov 04 '15 at 12:05
27

I know this is an old thread but I just had to weigh in. We had the same issue with EOT and WOFF fonts in all versions of Internet Explorer (7-11) not loading over HTTPS. After hours of trial and error and comparing our headers with other working sites we found it was the vary header that was messing things up. Unsetting that header for those file types fixed our issue right away.

<FilesMatch "\.(woff)$">
    Header unset Vary
</FilesMatch>

<FilesMatch "\.(eot)$">
    Header unset Vary
</FilesMatch>

Bonus Reading

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Chris Haas
  • 53,986
  • 12
  • 141
  • 274
  • Where do I have to put the above lines of code in my application, as I am experiencing the same issue you had experienced earlier. – HarshSharma Jan 10 '17 at 10:22
  • If your server is Apache it would go in the .htaccess file. If your server is Nginx/IIS/anything else you'll need to convert these rules. I would recommend asking another question giving more specific detauls and referencing this thread. – Chris Haas Jan 10 '17 at 14:22
  • I know it is to put somewhere to a conf file inside XAMPP's Apache folder but where? Care to explain where? – Jimwel Anobong May 02 '17 at 06:09
  • You should be able to create a regular text file called `.htaccess` (note the period/full stop at the front) in the root of your web directory with these directives. – Chris Haas May 02 '17 at 13:05
  • Worked one time in the past (I didn't put it in an htaccess file of my virtual host root but rather somewhere in the apache/xampp conf file and now did do the .htaccess thing and nothing happens at all. Still looking at the browser's same console output. – Jimwel Anobong May 07 '17 at 11:00
  • @ChrisHaas Wow, you're a star! – Thomas Cheng Jul 13 '18 at 13:22
8

This usually happens due to following response headers while downloading the .woff or .eot files.

  • Cache-Control = no-cache, no-store, max-age=0, must-revalidate
  • Pragma = no-cache

In My case I am using spring-boot and to remove these header I had to do following . which solved the issue as well.

public class SecurityConfig extends WebSecurityConfigurerAdapter { 
@Override
public void configure(HttpSecurity http) throws Exception {
   http.headers().defaultsDisabled()
        .addHeaderWriter(new StaticHeadersWriter("Cache-Control"," no-cache,max-age=0, must-revalidate"))
        .addHeaderWriter(new StaticHeadersWriter("Expires","0"));
 }
}
  • 2
    if you want to keep the rest of the default headers you could write `.headers().cacheControl().disable()` instead of `.headers().defaultsDisabled()` – Misha K Feb 08 '17 at 09:05
4

Without cache headers, I have noticed that IE9 clients on Windows Vista still do not load fonts (even though on my newer development machine IE11 in IE9 emulation mode does so).

I was able to fix the issue on the client machines, in the Internet Explorer, by going to:

  • Internet Options
  • Advanced
  • Security

And unchecking the “Do not save encrypted pages to disk” option.

Bonus Reading

HTH

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
TObject
  • 41
  • 2
  • 1
    Thank you, that helpme me :) Here is the [msdn blog](http://blogs.msdn.com/b/ieinternals/archive/2011/05/07/downloads-and-flash-fail-when-do-not-save-encrypted-pages-to-disk-is-set.aspx) that says headers are not consulted. – ProgramCpp Sep 16 '15 at 09:06
4

Here is my fix:

Using the URL Rewrite Addon for IIS to set Cache-Control header for all EOT files:

<system.webServer>
....
<rewrite>
  <outboundRules>
    <rule name="Fix IE9 missing font icons">
      <match serverVariable="RESPONSE_Cache_Control" pattern=".*" />
      <conditions>
          <add input="{REQUEST_URI}" pattern="\.eot.*" />
      </conditions>
      <action type="Rewrite" value="private, max-age=36000" />
    </rule>
  </outboundRules>
</rewrite>
</system.webServer>
user2173353
  • 4,316
  • 4
  • 47
  • 79
  • Using IE, SSL (HTTPS), with the following response headers:Cache-Control: no-store, no-cache, must-revalidate, max-age=0. This fixed my issue. – user3335999 Jan 30 '18 at 23:54
  • @user3335999 For some files, using caching is good for performance. If your files are EOT files, maybe it will be good to not disable the cache entirely. – user2173353 Jan 31 '18 at 10:52
3

I seem to remember certain versions of IE cannot use an @fontface font hosted outside the site's domain (If the page is at http://a.domain.tld/page.html - font must also be in the http://a.domain.tld/) for one reason or another. Put the EOT file on your domain and try again maybe.

IE9 blocks download of cross-origin web font

Community
  • 1
  • 1
amcc
  • 2,608
  • 1
  • 20
  • 28
  • If you look at my sample page, you'll see the page is hosted on a different domain than the font, and it works fine with HTTP, but not HTTPS. Putting the EOT on the same domain as the page is not an option as it's hosted by a CDN. – Greg Oct 13 '11 at 01:10
  • I did and hence I suggested host it on your domain. May I suggest you then try a [reverse proxy](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html) if you are running under *nix in order to trick the browser into thinking the content is on your domain. – amcc Oct 13 '11 at 01:14
  • Right, but it is working cross-domain with the non-HTTPS protocol, which leads me to believe it has something to do with HTTPS, not cross-domain. The reverse proxy solution is smart, but unfortunately wont work as we don't have access to the server configuration of the hosted file. – Greg Oct 13 '11 at 19:19
  • same issue here, even if all our fonts are hosted on the same server (and domain) of the page using them. – Vito Meuli Jun 17 '13 at 15:25
2

Working solution for Apache/2.2.15 is to add .htaccess

<FilesMatch "\.(woff)$">
    Header unset Cache-control
</FilesMatch>

<FilesMatch "\.(eot)$">
    Header unset Cache-control
</FilesMatch>
Ar2r
  • 108
  • 7
2

This issue has now been resolved by adding the following entries to the httpd.conf or .htaccess in apache server.

In order to get it to work we have changed from using FilesMatch to LocationMatch and now the headers are being set perfectly.

To set right mime-types for font files, add this lines to config:

 AddType application/vnd.ms-fontobject .eot
 AddType font/truetype .ttf
 AddType font/opentype .otf
 AddType font/opentype .woff
 AddType image/svg+xml .svg .svgz

To update font files headers, This fix perfectly worked to render Font Icons in IE Browsers.

<LocationMatch "\.(eot|otf|woff|ttf)$">
   Header unset Cache-Control
   Header unset no-store
</LocationMatch >
srikanth_yarram
  • 957
  • 9
  • 16
1

This sounds like a problem with your CDN. You can verify this by changing your host file to have your SSL domain point to whatever IP your non-SSL traffic is served over. If the font renders, you'll need to call up your CDN and figure out what their servers are doing to font files.

tterragnoj
  • 11
  • 2
1

I Faced a similar issue, but it was the Vary header that was the culprit. In my setup I was using Ruby on Rails with the rack-cors gem. It was giving the font files a header of Vary: Origin. To fix this you can set the header to Accept-Encoding where you set up the middleware:

config.middleware.insert_before 0, "Rack::Cors", :debug => true, :logger => (-> { Rails.logger }) do
  allow do
    origins '*'

    resource '/cors',
      :headers => :any,
      :methods => [:post],
      :credentials => true,
      :max_age => 0

    resource '*',
      :headers => :any,
      :methods => [:get, :post, :delete, :put, :options, :head],
      :max_age => 0,
      vary: ['Accept-Encoding'] # Required or IE11 fonts will break
  end
end
mahi-man
  • 4,326
  • 2
  • 25
  • 36
1

Did you try directly downloading the EOT file over https? The SSL certificate appears to be bad (mismatched), which could very well be your problem.

You should also make sure that there is a cross-domain policy set up for those files so while it may not be a factor in this issue, it could cause problems for certain browsers.

ldg
  • 9,112
  • 2
  • 29
  • 44
  • Good point, I hadn't thought about the SSL certificate mismatch problem! I'll do some research to that end. And yes, the server is sending a content-access-allow-origin=* header with the font, so that should be good. We were having a problem with Firefox until that was added. – Greg Oct 13 '11 at 19:30
  • Good thought, but I don't think this is the issue - I added a comment on the initial question to explain. – Greg Oct 13 '11 at 19:44
0

Ok, as far as I can tell this is an IE8 bug. I created a workaround that at least works on Apache - use mod_rewrite to force HTTP for requests ending in '.eot' or '.eot?' and force HTTPS for all other requests. In your .htaccess file, do:

<IfModule mod_rewrite.c>
  RewriteEngine on

  # if HTTPS request, force to HTTP if file ends in '.eot' or '.eot?'
  RewriteCond %{SERVER_PORT} 443
  RewriteCond %{REQUEST_URI} ^.*\.eot\??$
  RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

  # if HTTP request, force to HTTPS if file does NOT end in '.eot' or '.eot?'
  RewriteCond %{SERVER_PORT} 80
  RewriteCond %{REQUEST_URI} !.*\.eot\??$
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

</IfModule>

Not exactly pretty and I'm sure it adds some server overhead, running the string comparison every single request, but it fixes the issue :)

siliconrockstar
  • 3,554
  • 36
  • 33
  • Interesting solution - glad it worked for you. In my case I didn't have the ability to modify mod_rewrite rules. Ended up just using a different font in IE =( – Greg Oct 12 '12 at 21:29
  • Thanks Greg. Yeah, definitely requires access to mod_rewrite :/ – siliconrockstar Oct 14 '12 at 19:14
  • For a HTTPS page, browsers will issue warnings that your page has resources that are not secure. For example you will get a Yellow Lock in Chrome https://support.google.com/chrome/answer/95617?hl=en – gbakernet Feb 19 '14 at 04:33
0

Hi I've just run into the same problem and I've found a fix, hope this can help others.

It is a bug in IE <= 8 as commented. You can see some information on the problem here https://communities.bmc.com/thread/88899. Basically the problem is downloading a file in IE over https with Cache: no-cache headers being set, try remove the cache headers to see if that is your problem.

This answer may also help IE : Unable to download * from *. Unable to open this Internet site. The requested site is either unavailable or cannot be found

Community
  • 1
  • 1
refactorthis
  • 1,893
  • 15
  • 9
0

Wanted to share my situation and solution in hopes it helps the next person.

My fonts were being delivered over HTTPS via Amazon CloudFront, which was configured to serve static assets from our application that lives behind an Elastic Load Balancer.

The fonts had the following headers:

Access-Control-Allow-Origin: *
Cache-Control: public, max-age=100000
Cache-Control: no-cache="set-cookie"

Based on other answers and things I could find on the internet, I would've expected this to work, since it was setting a max-age and had proper CORS configuration. However, IE9 still would not render the fonts.

The issue turned out to be the Cache-Control: no-cache="set-cookie" header, which surprised me because that just says to not cache the Set-Cookie header (unless I'm mistaken).

It took me awhile to figure out where that header was coming from. This header was being added by our ELB because we are using sticky sessions via cookies, and I guess the load balancer is configured to use this Cache-Control header when it is setup that way.

So turning off sticky sessions removed the header, and caused the fonts to render. We were able to turn off sticky sessions for HTTP requests, and leave them on for HTTPS requests, which is fine because we force SSL for any non-static assets, but happily serve static assets to CloudFront with or without SSL.

Hope someone else can find this information useful.

Sean Adkinson
  • 8,425
  • 3
  • 45
  • 64
0

Quite old question, but I think no one answered correctly. The problem is that the font has been loaded from another file and for me this seems to be a case for Access-Controll-Allow-Origin.

It's working pretty much straigth forward add the following in your virtualhosts file or in .htaccess:

<ifModule mod_headers.c>
    Header set Access-Control-Allow-Origin: *
</ifModule>

and restart the apache

Nik Chankov
  • 6,049
  • 1
  • 20
  • 30
0

Using web font with IE 11 over HTTPS can be problem while using HTTP works fine.

There are only specific version of IE 11 affected, e.g.

  • Version 11.0.9600.19035, Update version 11.0.65
  • Version 11.0.9600.17728, Update Version 11.0.18.

Both are IEs on Win 7. I haven't seen the problem on Win 8 or Win 10.

Even though Google states to support Microsoft Internet Explorer version 6+, their fonts are affected in the same way as described above.

Currently I know of no workaround, not even a way of detecting affected versions via HTML/CSS/JavaScript.

jofeu
  • 65
  • 3
0

I was able to solve the problem with not working fonts in IE on https pages. the only working option that I found was to download a font in base64 via css

@font-face {
    font-family: 'your font name';
    src: url('data:application/font-woff2;charset=utf-8;base64,...base64FontWoff2...') format('woff2'),url('data:application/font-woff;charset=utf-8;base64,...base64FontWoff...') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

on this site you can prepare a css file here - https://transfonter.org/

0

Try full URLs with https://... . As https is slower because of the enlarging and uncompressable files, there are some tricks to deliver mixed http/https content, without getting an "insecure content" warning. You might search for them. Never needed to use such tricks.

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138
  • Thanks Joop, if you look at my sample page you will see I tried using full URLs with "https" to no avail. Good point about SSL being slower, but the question isn't about HTTPS speed or mixed content, but thanks for writing anyway. – Greg Oct 13 '11 at 00:57