|
@@ -28,9 +28,9 @@ public class CorsFilter implements Filter {
|
|
// System.out.println("access from "+reqs.getHeader("Origin"));
|
|
// System.out.println("access from "+reqs.getHeader("Origin"));
|
|
response.setHeader("Access-Control-Allow-Origin",reqs.getHeader("Origin")); //直接用"*"无法解决跨域问题
|
|
response.setHeader("Access-Control-Allow-Origin",reqs.getHeader("Origin")); //直接用"*"无法解决跨域问题
|
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
|
- response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, OPTIONS");
|
|
|
|
|
|
+ response.setHeader("Access-Control-Allow-Methods", reqs.getHeader("Access-Control-Request-Method"));
|
|
response.setHeader("Access-Control-Max-Age", "3600");
|
|
response.setHeader("Access-Control-Max-Age", "3600");
|
|
- response.setHeader("Access-Control-Allow-Headers", "x-requested-with, id, token");
|
|
|
|
|
|
+ response.setHeader("Access-Control-Allow-Headers", reqs.getHeader("Access-Control-Request-Headers"));
|
|
chain.doFilter(req, res);
|
|
chain.doFilter(req, res);
|
|
}
|
|
}
|
|
public void init(FilterConfig filterConfig) {}
|
|
public void init(FilterConfig filterConfig) {}
|