How to display Font Awesome icons in Firefox?

▼魔方 西西 提交于 2019-12-07 21:52:16

问题


I'm using the Font-Awesome-Sass-Rails gem for icon fonts and they display properly in all browsers but Firefox. I'm currently using Cloudfront and Nginx. Here is my CORS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Any ideas?


回答1:


If the answer above does not solve anyone's problem then here is my solution which is working :

# Cross domain webfont access
location ~* \.(?:ttf|ttc|otf|eot|woff|font.css)$ {
add_header "Access-Control-Allow-Origin" "*";
expires 1M;
access_log off;
add_header Cache-Control "public";
}



回答2:


When I had the same problem I found the only solution which worked for me was setting a header within nginx itself.

location ~* \.(eot|otf|ttf|woff)$ {
    add_header  Access-Control-Allow-Origin *;
}



回答3:


examples above did not work, this worked. in nginx config, put if block inside /assets/ rule

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;

    if ($request_filename ~* ^.*?\.(eot)|(ttf)|(woff)|(svg)|(otf)$) {
       add_header Access-Control-Allow-Origin *;
    }
  }


来源:https://stackoverflow.com/questions/15080434/how-to-display-font-awesome-icons-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!