springboot security 项目出现 in a frame because it set 'X-Frame-Options' to 'deny'

springboot security 项目出现 in a frame because it set 'X-Frame-Options' to 'deny'

springboot security 项目通过链接打开一个新的页面时,出现 in a frame because it set 'X-Frame-Options' to 'deny' 错误,如下图所示


解决方法:

//防止iframe
@Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() .authorizeRequests() .anyRequest().permitAll() .and().logout().permitAll(); http.headers().frameOptions().disable(); } }
加上以上代码即可解决问题
  • 发表于 2020-06-19 10:30
  • 阅读 ( 3009 )
  • 分类:Java

0 条评论

请先 登录 后评论
不写代码的码农
威猛的小站长

124 篇文章

作家榜 »

  1. 威猛的小站长 124 文章
  2. Jonny 65 文章
  3. 江南烟雨 36 文章
  4. - Nightmare 33 文章
  5. doublechina 31 文章
  6. HJ社区-肖峰 29 文章
  7. 伪摄影 22 文章
  8. Alan 14 文章