首頁  >  文章  >  運維  >  Apache/Nginx下Font Awesome在Firefox中不顯示怎麼解決

Apache/Nginx下Font Awesome在Firefox中不顯示怎麼解決

王林
王林轉載
2023-05-21 17:43:061260瀏覽

一、nginx伺服器解決方法

伺服器使用的是nginx,要在回應的頭部添加access-control-allow-origin 字段,新增方法是用add_header 指令:

設定範例:

複製程式碼 程式碼如下:

location /assets/ {
    gzip_static on;
    expires max;
    add_##    expires max;
    add_##   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 Vution##vestf ##fations#fations , i found out the workaround: set a access-control-allow-origin header to the font.


複製程式碼 程式碼如下:

#

 

    header set access-control-allow-origin "*"
  ##c ;

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 *;

}

#

以上是Apache/Nginx下Font Awesome在Firefox中不顯示怎麼解決的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:yisu.com。如有侵權,請聯絡admin@php.cn刪除