在spring boot项目中出现不能加载iframe
页面报一个"Refused to display 'http://......' in a frame because it set 'X-Frame-Options' to 'DENY'. "错误
解决方式:
因spring Boot采取的java config,在配置spring security的位置添加:
@Override protected void configure(HttpSecurity http) throws Exception { http.headers().frameOptions().disable(); http .csrf().disable(); http .authorizeRequests() .anyRequest().authenticated(); http.formLogin() .defaultSuccessUrl("/platform/index",true) .loginPage("/login") .permitAll() .and() .logout() .logoutUrl("/logout"); http.addFilterBefore(wiselyFilterSecurityInterceptor(),FilterSecurityInterceptor.class); }
新书推荐《JavaEE开发的颠覆者: Spring Boot实战》,涵盖Spring 4.x、Spring MVC 4.x、Spring Boot企业开发实战。
京东地址:http://item.jd.com/11894632.html
当当地址:http://product.dangdang.com/23926195.html
亚马逊地址:http://www.amazon.cn/图书/dp/B01D5ZBFUK/ref=zg_bsnr_663834051_6
淘宝地址:https://item.taobao.com/item.htm?id=528426235744&ns=1&abbucket=8#detail
或自己在京东、淘宝、亚马逊、当当、互动出版社搜索自选。