通过spring security登陆后,跳转到嵌套页面,报错:
index:1 Refused to display 'http://localhost:8080/home' in a frame because it set 'X-Frame-Options' to 'deny'.
看到了这个
https://blog.csdn.net/a494567309/article/details/80348557
解决方法:
在继承自 WebSecurityConfigurerAdapter 的类中复写 configure 方法,在其中添加
http.headers().frameOptions().disable()
如下:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers().frameOptions().disable();
}
}