项目中用到iframe嵌入网页,然后用到springsecurity就被拦截了 浏览器报错  x-frame-options deny 

原因是因为springSecurty使用X-Frame-Options防止网页被Frame

.headers().frameOptions().disable()

解决办法把x-frame-options disable即可

 protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()
                .and()
                .headers().frameOptions().disable()
                .and()
                .logout().logoutSuccessUrl("/login")
                .permitAll();
    }

 

相关文章:

  • 2022-01-11
  • 2022-12-23
  • 2022-12-23
  • 2021-04-25
  • 2021-12-09
  • 2021-07-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-08-31
  • 2021-06-25
  • 2021-10-28
  • 2021-12-03
相关资源
相似解决方案