@Override
public void configure(HttpSecurity http) throws Exception {
//放开所有资源请求URL
http.authorizeRequests().antMatchers("/*").permitAll();
//取消csrf防护
http.csrf().disable();
// X-Frame-Options 响应头跨域,主要是这句
http.headers().frameOptions().disable();
}
说明:
http.headers().frameOptions().disable(); // 任何跨域
http.headers().frameOptions().sameOrigin(); // 同源跨域