VUE使用 iframe 嵌入网页,浏览器报错 x-frame-options deny

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

Refused to display ‘网址' in a frame because it set 'X-Frame-Options' to 'deny'. 

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

 

VUE使用 iframe 嵌入网页,浏览器报错 x-frame-options deny_第1张图片

 解决办法把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();
    }

--------------------- 
作者:white...... 
来源:CSDN 
原文:https://blog.csdn.net/whiteforever/article/details/73201586 
版权声明:本文为博主原创文章,转载请附上博文链接!

 

你可能感兴趣的:(VUE,vue,springBoot,springSecurty)