@字体面与标题设置访问控制 - 允许 - 产地和QUOT; *"产地、访问控制、字体、标题

2023-09-02 11:40:13 作者:别太久

我用下面的规则,让我们的静态域来承载字体,但我碰到的一个问题,字体不是正在使用的浏览器(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...
 
精彩推荐
图片推荐