JFinal 对于跨域options 预检问题咋处理啊,由于预检 这样每次发两次请求过来,导致我上传文件失败, 因为第一次预检请求options 是没发送 mutilpart/form-data 请求头的。。 我加下面的代码好像没用
if (allowedOrigins.contains(originHeader)){ response.setHeader("Access-Control-Allow-Origin", originHeader); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS,DELETE,PUT"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With,Origin,Token,Accept, Connection, User-Agent, Cookie"); if("OPTIONS".equals(request.getMethod())){ response.setStatus(HttpServletResponse.SC_NO_CONTENT); return; } }
项目:JFinal