springBoot springSecurty: x-frame-options deny禁止iframe調用

springBoot springSecurty:  x-frame-options deny禁止iframe調用html

https://blog.csdn.net/whiteforever/article/details/73201586spring

 

 

項目中用到iframe嵌入網頁,而後用到springsecurity就被攔截了 瀏覽器報錯  x-frame-options deny 瀏覽器

緣由是由於springSecurty使用X-Frame-Options防止網頁被Frameui

 

.headers().frameOptions().disable()

  

解決辦法把x-frame-options disable便可.net

 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();
    }
相關文章
相關標籤/搜索