Apache、Nginx下Font Awesome在 Firefox 中不显示问题解决方法

这篇文章主要介绍了Apache、Nginx下Font Awesome在 Firefox 中不显示问题解决方法,在配置中增加一个响应头即可解决这个问题,需要的朋友可以参考下

一、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 *;
}

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

一:确定你的系统是UTF编码 [root@Tserver ~]# env|grep LANG LANG=en_US.UTF-8 二:NGINX配置文件里默认编码设置为utf-8 server { listen 80; server_name .inginx.com ; index index.html index.htm index.php; root /usr/local/nginx/html/inginx.com; ch
安装 Apache 出现 OS 10013 以一种访问权限不允许的方式做了一个访问套接字的尝试 如下截图: 提示: make_sock: could not bind to address 0.0.0.0:80 这个问题有由于计算机上安装了IIS7,80端口已占用。 打开Apache 的配置文件 Apache安装目录下的conf/htt
很多网站需要采用伪静态来访问动态网页。所以像phpcms这样的系统,都提供了一个.htaccess文件,供写伪静态规则。但这个规则是针对Apache的。在nginx服务器上并不起作用。 nginx 可以直接将伪静态规则写在配置文件中,但这个需要有服务器管理权限,普通站长不
在网站建设中需要网页重定向的情况很多:如网页目录结构变动,网页重命名、网页的扩展名改变、网站域名改变等。如果不做重定向,用户的收藏和搜索引 擎数据库中的旧地址只能让访客得到一个404错误信息页面,访问流量白白丧失。不仅如此,之前该页面的一切积
apache web服务器的站点,下载pptx,docx,xlsx文件,却被浏览器当作zip文件保存。 这不是浏览器的问题,而是apache不认docx,pptx,,xlsx等Microsoft Office 2007+的文件格式,而这些文件本身是zip压缩文件,所以被apache当作zip压缩文件发给浏览器了。 做个形
利用nginx泛域名解析配置二级域名和多域名 网站的目录结构为 html ├── bbs └── www html为nginx的安装目录下默认的存放源代码的路径。 bbs为论坛程序源代码路径 www为主页程序源代码路径 把相应程序放入上面的路径通过 http://www.youdomain.com 访问