yaobo 7 年 前
コミット
21421a44cb
1 ファイル変更2 行追加2 行削除
  1. 2 2
      src/main/java/cn/efunbox/audio/aop/CorsFilter.java

+ 2 - 2
src/main/java/cn/efunbox/audio/aop/CorsFilter.java

@@ -28,9 +28,9 @@ public class CorsFilter implements Filter {
 //        System.out.println("access from "+reqs.getHeader("Origin"));
         response.setHeader("Access-Control-Allow-Origin",reqs.getHeader("Origin")); //直接用"*"无法解决跨域问题
         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-Allow-Headers", "x-requested-with, id, token");
+        response.setHeader("Access-Control-Allow-Headers", reqs.getHeader("Access-Control-Request-Headers"));
         chain.doFilter(req, res);
     }
     public void init(FilterConfig filterConfig) {}