`The value of the ‘Access-Control-Allow-Origin‘ header in the response must not be the wildcard

详细错误信息 Access to XMLHttpRequest at ‘http://localhost:7894/Login’ from origin ‘http://localhost:8080′ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: 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.


 

前端可以删除

// axios.defaults.withCredentials = true

 

或者后端可以加上

Access-Control-Allow-Credentials = true //允许携带验证信息

发表评论