CORS policy: header is present on the requested
欢迎使用Markdown编辑器
Access to XMLHttpRequest at 'http://127.0.0.1:8004/down/download' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190701163909146.png)
解决方法
response.setHeader("Access-Control-Allow-Origin","*");
response.setHeader("Access-Control-Allow-Methods","POST,GET,OPTIONS");
response.setHeader("Access-Control-Allow-Headers"," Origin, X-Requested-With, Content-Type, Accept");
请求结果:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190701164203608.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTI5NzY4Nzk=,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190701164244517.png)