子域名访问根域名的CSS时,发现字体无法显示,在确保CSS和Font字体的路径加载无问题后,基本确定是因为跨域的问题(火狐浏览器)
CSS @font-face not working with Firefox, but working with Chrome and IE
Nginx:在Nginx的conf目录下修改nginx.conf或者vhost下对应的domain conf,添加以下代码:
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
https://gist.github.com/michiel/1064640
# BEGIN REQUIRED FOR WEBFONTS
AddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/woff .woff
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
# END REQUIRED FOR WEBFONTS