使用font-face和Apache负载均衡器的跨域问题

时间:2018-02-23 12:47:25

标签: apache cross-domain load-balancing font-face cross-domain-policy

我在apache负载均衡器后面有2个应用程序节点,如下所示:

    ProxyRequests off
<Proxy balancer://webfarm>
    BalancerMember http://192.168.1.14:80
    BalancerMember http://192.168.2.15:80
    ProxySet lbmethod=byrequests
</Proxy>

<Location /balancer-manager>
    SetHandler balancer-manager
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://webfarm/

通过IP单独访问实例时,字体正常加载。但是,从负载均衡器访问似乎存在跨域问题:

Access to Font at 'http://192.168.1.14/fonts/open-sans/OpenSans-Bold.ttf' from origin 'http://192.168.10.10' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.10.10' is therefore not allowed access.

我已尝试在负载均衡器的两个节点和httpd.conf上设置标头,如下所示:

AddType application/x-font-ttf           ttc ttf
AddType application/x-font-otf           otf
AddType application/font-woff            woff
AddType application/font-woff2           woff2
AddType application/vnd.ms-fontobject    eot

<FilesMatch ".(eot|ttf|otf|woff|woff2)">
  Header set Access-Control-Allow-Origin "*"
</FilesMatch>

并在所有实例上重新启动apache。似乎没有用。 非常感谢您的帮助。

提前致谢。

0 个答案:

没有答案
相关问题