开发者

@font-face and Header set Access-Control-Allow-Origin "*"

开发者 https://www.devze.com 2023-01-13 20:39 出处:网络
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.

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!

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


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

Header set always Access-Con...
0

精彩评论

暂无评论...
验证码 换一张
取 消