在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);
}
http://wiselyman.iteye.com/blog/2206492
本文介绍了解决Spring Boot项目中iframe加载失败的问题。通过禁用X-Frame-Options设置,确保页面能在iframe中正常加载。
393

被折叠的 条评论
为什么被折叠?



