nodejs 跨域出现错误

2022-01-24 08:46:37 浏览数 (1)

错误日志如下:

Failed to load http://115.159.52.223:3000/user/admin-userLogin: 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://192.168.16.220:8000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

服务端编写如下:

原因为 使用axios 发起请求时 配置了参数

代码语言:javascript复制
withCredentials: true,

去掉即可

0 人点赞