前端报错为:headers 报错Request header field Content-Type is not allowed by Access-Control-Allow-Headers
解决方法:后端的CORS过滤器中需要将response.setHeader(“Access-Control-Request-Headers”,"*");
改成
response.setHeader(“Access-Control-Allow-Headers”, “Origin, X-Requested-With, Content-Type, Accept,token,Access-Token”);
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
response.setHeader("Access-Control-Max-Age", "1728000");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("content-type","text/html;charset=UTF-8");
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept,token,Access-Token");
记录一下,以后出现可以找到解决方法