Spring boot X-Frame-Options 异常 a frame because it set 'X-Frame-Options' to 'deny'

a frame because it set 'X-Frame-Options' to 'deny'

在spring security配置的位置添加

http.headers().frameOptions().disable();

    protected void configure(HttpSecurity http) throws Exception {
        http.headers().frameOptions().disable();
        http.authorizeRequests()
                .antMatchers("/login", "/logout", "/getVerifyCode", "/validateVerifyCode")
                .permitAll()
                .anyRequest().authenticated()

                .and()
                .formLogin()
                .loginPage("/login")
                .successForwardUrl("/success")
                .failureForwardUrl("/failure")

                .and()
                .logout()
                .logoutUrl("/logout")
                .invalidateHttpSession(true)

                .and()
                .csrf().disable();
    }

猜你喜欢

转载自www.cnblogs.com/yangchongxing/p/12284022.html
今日推荐