2019-08-14 02:38

或者用Nginx

2019-08-14 02:36

@JFinal web.xml 中配置cors-filter 可以解决跨域 换成undertow启动 加载cors-filter 也不起作用 用这篇文章得办法 也没用 老大有没有undertow 跨域的demo 不然我就只能打war包 用tomcat这唯一的办法了

2019-08-14 02:30

还是不行 ajax 已经设置了
xhrFields: {withCredentials: true}
crossDomain: true
Controller中也设置了
String origin=getRequest().getHeader("Origin");
getResponse().addHeader("Access-Control-Allow-Origin", origin);
getResponse().addHeader("Access-Control-Allow-Credentials", "true");
还是报错
Access to XMLHttpRequest at 'http://127.0.0.1/login' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Request header field access_token is not allowed by Access-Control-Allow-Headers in preflight response.
搞了几天了 什么办法都试了 就是解决不了