通過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();
}
}