1.控制台报这个错误,Access to XMLHttpRequest at 'http://10.101.0.34:3000/secu/service/sys/user/loginByPassword' from origin 'http://192.168.10.27: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. 看起来问题很明确,跨域问题,说 Access-Control-Allow-Origin 不能为 *,所以需要改成 res.setHeader('Access-Control-Allow-Origin', req.headers.origin)。
2Request header field ’*‘ is not allowed by Access-Control-Allow-Headers in preflight response. 这个 报错简单 ,就是你axios 里面自定义的header 都需要在服务端报备, res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type, Authorization,client-page-path,client-version'); 在这里添加进去