springBoot springSecurty x-frame-options deny

spring Security下,X-Frame-Options默认为DENY,非Spring Security环境下,X-Frame-Options的默认大多也是DENY:

    DENY:浏览器拒绝当前页面加载任何Frame页面
    SAMEORIGIN:frame页面的地址只能为同源域名下的页面
    ALLOW-FROM:origin为允许frame加载的页面地址。
解决办法:disable x-frame-options 选项

        http.authorizeRequests()
                .antMatchers("/").permitAll()
//                .anyRequest().authenticated()   // 其他地址的访问均需验证权限
                .and()
                .formLogin()
                .loginPage("/login.html")   //  登录页
                .failureUrl("/login-error.html").permitAll()

                // 禁用frameOptions
                .and().headers().frameOptions().disable().and()

                .logout()
                .logoutSuccessUrl("/public/test/index.html");
                ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry
                        = http.authorizeRequests();
                registry.requestMatchers(CorsUtils::isPreFlightRequest).permitAll();    
原文地址:https://www.cnblogs.com/itachilee/p/13226560.html