No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'xxx' is theref
No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘xxx’ is therefore not allowed
解决方法:
第一种.如果重复设置了跨域,也就是tomcat或者nginx设置了跨域,服务代码也设置跨域那么设置就没效果了
第二种.使用spring的@CrossOrigin注解写在要跨越的类的上面,http://123.com和http://456.com是请求方的域名
@CrossOrigin(origins = {“http://123.com","http://456.com"\})
第三种.如果被请求方通过nginx代理,那么可以在nginx中配置文件中被请求方的server节点中添加:http://www.yayihouse.com/yayishuwu/chapter/2402
第四种.也可以在代码中添加过滤器:http://www.yayihouse.com/yayishuwu/chapter/2402
还没有评论,来说两句吧...