一、Nginx服务器解决方法
服务器使用的是 Nginx,要在响应的头部添加 Access-Control-Allow-Origin 字段,添加方法是用 add_header 指令:
配置例子:
复制代码 代码如下:
location /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
二、Apache服务器解决方法
Font Awesome (firefox无法显示 火狐无法显示)Cross domain (跨域问题)
The problem
It seems that, for security reasons, Firefox simply don't allow you to use by default a font that is not hosted on your domain, not even on your subdomain. The CDN based websites can be also affected in this case.
The solution
After some investigations, I found out the workaround: set a Access-Control-Allow-Origin header to the font.
复制代码 代码如下:
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
Also, if you are using nginx as your webserver you will need to include the code below in your virtual host file:
复制代码 代码如下:
location ~* \.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
您可能感兴趣的文章:
- nginx缓存页面后 串会话问题的解决方法
- nginx缓存不起作用问题解决方法
- nginx、Apache、IIS服务器解决 413 Request Entity Too Large问题方法汇总
- 权限问题导致Nginx 403 Forbidden错误的解决方法
- Nginx中使用gzip_http_version解决CDN只支持http 1.0问题
- Nginx的c30k问题解决方法
- 总结Nginx 的使用过程中遇到的问题及解决方案
本文由 华域联盟 原创撰写:华域联盟 » Apache、Nginx下Font Awesome在 Firefox 中不显示问题解决方法
转载请保留出处和原文链接:https://www.cnhackhy.com/47452.htm