CORS policy: header is present on the requested

蔚落 2021-09-29 04:02 302阅读 0赞

CORS policy: header is present on the requested

  • 欢迎使用Markdown编辑器
    • 解决方法
    • 请求结果:

欢迎使用Markdown编辑器

  1. 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.

在这里插入图片描述

解决方法

  1. response.setHeader("Access-Control-Allow-Origin","*");
  2. response.setHeader("Access-Control-Allow-Methods","POST,GET,OPTIONS");
  3. response.setHeader("Access-Control-Allow-Headers"," Origin, X-Requested-With, Content-Type, Accept");

请求结果:

在这里插入图片描述

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,302人围观)

还没有评论,来说两句吧...

相关阅读