Javascript 尽管在上设置了CORS策略,但仍使用URL参数响应CORS

Javascript 尽管在上设置了CORS策略,但仍使用URL参数响应CORS,javascript,reactjs,cors,fetch,Javascript,Reactjs,Cors,Fetch,所以我尝试在使用componentWillMount加载组件之前发出一个获取数据的请求,但它一直抛出错误 Access to fetch at 'http://localhost:5000/mine/1/user_list' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It

所以我尝试在使用componentWillMount加载组件之前发出一个获取数据的请求,但它一直抛出错误

Access to fetch at 'http://localhost:5000/mine/1/user_list' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
现在我尝试了其他相关问题中提出的所有解决方案。我尝试的一些方法是在标题中设置'Allow CORS'参数。我也有谷歌浏览器工具,可以打开CORS,而且已经打开了。除此之外,我还尝试将参数保留在模式的fetch请求中

但它不起作用。有趣的是,如果我尝试使用常量URL,那么请求会顺利通过,没有任何问题。但是,当我使用自定义路径URL时,如下所示+mine/+activeSite+/user\u list;然后问题开始了。我附上了代码的一小部分供您参考

我的后端是Python3和restplus。它没有在后端接收请求。错误在发出获取请求之前抛出。我的控制器在后端的CORS上没有这样的策略。但我假设如果其他请求在应用程序中正常工作,那么在后端没有该策略的情况下,应该可以正常工作。此外,我还使用Swagger UI测试了该功能,效果良好

import React, { Component } from "react";
import Select from "react-select";
import { serverConst } from "../constants/system";
import { getAuthHeader } from "../helper/authHeader";

class TaskForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      assigned: "",
      assigner: [],
      reporter_list: [],
      operationSucceed: false,
      error: ""
    };

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  componentWillMount() {
    let activeSite = localStorage.getItem("activeMinesite");
    if (activeSite) {
      const request_url = serverConst.SERVER_URL + "mine/" + activeSite + "/user_list";
      fetch(request_url, {
        method: "GET",
        mode: "cors",
        headers: getAuthHeader()
      }).then(response => {
        response.json().then(json => {
          console.log(response);
        });
      });
    }
  }

您是否可以尝试使用以下命令行启动Chrome:

open -a Google\ Chrome --args --disable-web-security --user-data-dir