zoukankan      html  css  js  c++  java
  • 请求服务器报错 Access-Control-Allow-Origin

    今天遇到一个问题,发送请求能够成功了,返回的数据也能在 network 中看见,但是报错:

    Access to XMLHttpRequest at 'http://192.168.200.112:8080/lottery/getIsWinLottery?Id=966&succ7F0D92C70492DCD' from origin 'http://192.168.200.196' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

    请求状态码为200,在 network 中也能看到返回的数据,但是控制台没有打印信息。

    搜了半天发现了解决方案:

    withCredentials: false, // 允许携带cookie

    其他方案都需要后端调配置。

     

    Failed to load http://pre.api.jmxy.mockuai.c...: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://pre.promotion.jmxy.moc...' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

  • 相关阅读:
    3月30日
    3月29日
    3月26日
    3月24
    3月22日
    3月20日
    博弈论基础
    $burnside$引理与$pacute olya$定理
    min-max容斥
    模板
  • 原文地址:https://www.cnblogs.com/joe235/p/13374284.html
Copyright © 2011-2022 走看看