浏览器 拦截 请求 CORS
是不是浏览器不行,但是 使用postman 接口调用 又可以
Access to XMLHttpRequest at 'http://xxxxxxxxx:8081/api/xxx/login' from origin 'http://xxxxxxxxx:8085' 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.baseURL = “http://192.168.16.55:18081/api”
axios.defaults.timeout = 15000
axios.defaults.withCredentials = true
axios.defaults.crossDomain = true
···
==将 axios.defaults.withCredentials 参数 改为 false ==
改了就可以了