【Nginx】前端请求跨域问题

问题描述

Access to fetch at ‘xxx’ from origin ‘xxx’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

解决方案

找到Nginx配置中具体请求的server配置,找到配置: add_header Access-Control-Allow-Origin *;
注释该配置,重启Nginx后重试

相关推荐

  1. Nginx前端请求问题

    2024-07-19 15:00:04       22 阅读
  2. nginx处理问题

    2024-07-19 15:00:04       49 阅读
  3. 前端处理问题

    2024-07-19 15:00:04       58 阅读
  4. 前端解决问题

    2024-07-19 15:00:04       32 阅读
  5. 前端怎么实现请求

    2024-07-19 15:00:04       39 阅读
  6. 前端怎么实现请求

    2024-07-19 15:00:04       31 阅读
  7. 前后问题

    2024-07-19 15:00:04       50 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-19 15:00:04       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-19 15:00:04       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-19 15:00:04       58 阅读
  4. Python语言-面向对象

    2024-07-19 15:00:04       69 阅读

热门阅读

  1. Kotlin实现SHA-256哈希和RSA签名

    2024-07-19 15:00:04       23 阅读
  2. pathlib库

    2024-07-19 15:00:04       21 阅读
  3. vue 预览pdf

    2024-07-19 15:00:04       20 阅读
  4. LeetCode //C - 233. Number of Digit One

    2024-07-19 15:00:04       24 阅读
  5. Redis详解

    2024-07-19 15:00:04       21 阅读