@字体面与标题设置访问控制 - 允许 - 产地和QUOT; *" [英] @font-face and Header set Access-Control-Allow-Origin "*"

查看:296
本文介绍了@字体面与标题设置访问控制 - 允许 - 产地和QUOT; *"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的规则,让我们的静态域来承载字体,但我碰到的一个问题,字体不是正在使用的浏览器(Firefox,Safari浏览器)时,浏览器的缓存被启用。

I have used the following rule to allow our static domain to host fonts, but I've run into a problem font's not being used by the browser (firefox, safari) when the browser cache is enabled.

<Directory "/site/http/web/assets/fonts">
    <FilesMatch "\.(eot|otf|woff|ttf)$">
        SetEnvIf Origin "^http://(.*)?main-domain.com$" origin_is=$0
        Header set Access-Control-Allow-Origin %{origin_is}e env=origin_is
    </FilesMatch>
</Directory>

我也用下面的规则让浏览器知道它的确定以缓存静态内容:

I've also used the below rule to let browsers know it's ok to cache static content:

ExpiresActive On
ExpiresDefault "modification plus 10 years"

如果我浏览的浏览器缓存的网站关闭,字体加载和显示每次。

If I browse the site with the browser cache off, the fonts load and display every time.

如果我把我的浏览器缓存关闭,加载一个页面,字体得到加载(萤火虫>净值),但不显示!

If I turn my browser cache off and load a page, the fonts get loaded (firebug > net) but aren't displayed!

304含量不修改标题导致浏览器忽略我的努力?

Is the 304 Content Not Modified Header causing the browser to ignore my efforts?

推荐答案

如果你想成为一个非2xx响应中使用你的头此外,使用

If you want your header addition to be used on a non-2xx response, use

Header set always Access-Con...

这篇关于@字体面与标题设置访问控制 - 允许 - 产地和QUOT; *&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆