CORS error
最近Apache服务器不能加载某些资源,是个CORS
问题,就是跨域
。报错如下:
Access to Font at 'http://nanny.com/fonts/fontawesome-webfont.ttf?v=4.6.1' from origin 'http://www.nanny.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.nanny.com' is therefore not allowed access.
这可能是Apache的配置问题,也可能是Yii2 controller的问题。
网上说很多人说在.htaccess
文件中加一句Header set Access-Control-Allow-Origin "*"
即可,加了,没用。