您的位置:首页 > 编程语言 > Java开发

Spring Boot不允许加载iframe问题解决

2017-01-13 00:00 555 查看
在spring boot项目中出现不能加载iframe

页面空白,或者ie显示不允许加载页面

报一个"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()
.authorizeRequests()
.antMatchers("/suishoupai_search.do").hasRole("USER")
.and()
.formLogin()
.failureUrl("/login?failed=true")
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息