반응형
H2 데이터베이스 콘솔 스프링 부팅 로드가 X-Frame-Options에 의해 거부되었습니다.
spring 4 boot security 등으로 개발용 골격 프로젝트를 구축하고 있습니다.DB 콘솔에 로그인하여 db를 관리하려고 할 때 H2를 사용하면 다음 오류가 발생합니다.이 페이지는 공백이며 firebug konsole에 4개의 버그가 있습니다.
Load denied by X-Frame-Options: http://localhost:8080/console
링크 포함
/header.jsp?jsessionid=f71207a702c9177e57208414721bbe93 does not permit framing.
/query.jsp?jsessionid=f71207a702c9177e57208414721bbe93 does not permit framing.
/help.jsp?jsessionid=f71207a702c9177e57208414721bbe93 does not permit framing.
/tables.do?jsessionid=f71207a702c9177e57208414721bbe93 does not permit framing.
- 콘솔 수준에서 연결을 테스트할 수 있습니다. 문제 없습니다.
- DB는 정상적으로 동작하고 import.sql은 정상적으로 동작하며 spring이 기동하고 있는 사용자 엔티티를 생성할 수 있습니다.
사용하고 있는 설정은 에서 온 것입니다(xml 구성으로 스프링 3.2에서 동작합니다).
사용방법: spring-boot-starter-parent 1.1.4.풀어주다
또한 다음과 같이 @chrosciu의 답변을 단순화할 수 있습니다.
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers().frameOptions().disable();
}
}
Application.java에 다음 코드를 추가했습니다.현재 동작하고 있습니다.기본값은 포트 8082로 spring app부터 시작됩니다.정곡을 찌르지는 않지만 개발 목적상 아무 문제 없다.
@Bean
org.h2.tools.Server h2Server() {
Server server = new Server();
try {
server.runTool("-tcp");
server.runTool("-tcpAllowOthers");
} catch (Exception e) {
e.printStackTrace();
}
return server;
}
이 방법은 효과가 있었습니다.
@EnableWebSecurity
@Configuration
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers().addHeaderWriter(
new XFrameOptionsHeaderWriter(
new WhiteListedAllowFromStrategy(Arrays.asList("localhost"))));
}
}
물론 응용 프로그램이 localhost와 다른 환경에서 실행될 경우 화이트리스트의 내용을 조정해야 합니다.
언급URL : https://stackoverflow.com/questions/26220083/h2-database-console-spring-boot-load-denied-by-x-frame-options
반응형
'sourcetip' 카테고리의 다른 글
AngularJs에서 글로벌http 타임아웃을 설정하는 방법 (0) | 2023.03.04 |
---|---|
Oracle 11g Express Edition for Windows 64bit? (0) | 2023.03.04 |
대응: 스테이트리스 기능 컴포넌트의 PropType (0) | 2023.03.04 |
OracleCommand SQL 매개 변수 바인딩 (0) | 2023.03.04 |
내장된 Tomcat의 액세스 로그를 stdout으로 전송하도록 Spring Boot에 어떻게 지시합니까? (0) | 2023.03.04 |