springboot项目集成了spring security,对于跨域访问发起的options请求,会返回403,原因是security默认不允许options请求,需要做以下修改:
第一种方式:忽略options请求
web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**");
第二种方式:允许options请求
http.antMatchers(HttpMethod.OPTIONS, "/**").permitAll();
springboot项目集成了spring security,对于跨域访问发起的options请求,会返回403,原因是security默认不允许options请求,需要做以下修改:
第一种方式:忽略options请求
web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**");
第二种方式:允许options请求
http.antMatchers(HttpMethod.OPTIONS, "/**").permitAll();