No 'Access-Control-Allow-Origin' header is present on the requested resource.
CDN加速后发现问题:
XMLHttpRequest cannot load http://img. domain.com. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.domain.com' is therefore not allowed access.其实就是跨域问题,一般解决方案就是使用jsonp,但考虑到改动地方比较多,且jsonp只支持get.
解决方法
在被请求的Response header中加入
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:http://www.domain.com');
// 响应类型
header('Access-Control-Allow-Methods:POST,GET');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
![](https://images2015.cnblogs.com/blog/965606/201606/965606-20160601091544242-1481283569.png)