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 *;
}
相關文章
修改ubuntu 18.04的sources.list源為阿里或清華鏡像的方法
這篇文章主要介紹了修改ubuntu 18.04的sources.list源為阿里或清華鏡像的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-08-08Apache httpd 安裝module mod_expires、mod_deflate的方法
Apache httpd 安裝module mod_expires、mod_deflate的方法,需要的朋友可以參考下。2011-11-11Centos7實現(xiàn)MySQL基于日志還原數(shù)據(jù)的示例代碼
這篇文章主要介紹了Centos7實現(xiàn)MySQL基于日志還原數(shù)據(jù)的示例代碼,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-07-07