• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

Http2 적용 질문입니다.

20.10.26 02:40 작성 조회수 608

0

http2 프로토콜 적용시에 지속적으로 적용이 되지 않아 질문을 드립니다.

1, ssl 적용은 확인이 되었습니다.

2, undertow로 웹 애플리케이션 서버를 바꿨습니다.

3, jdk 8버전과 spring boot 2.3.4버전을 쓰고 있습니다.

해당 과정을 거치고 run을 할 시에 오류는 발생이 되지 않는데 http2가 계속 적용이 되지 않아서 질문을 드립니다.

 의존성 설정

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>

<properties>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>

properties설정

server.ssl.key-store= keystore.p12
server.ssl.key-store-password= 123456
server.ssl.keyStoreType= PKCS12
server.ssl.keyAlias= tomcat
server.port=8443
server.http2.enabled=true

controller

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class DemoApplication {

@GetMapping("/hello")
public String hello(){
return "hello";
}

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

결과

필수 설정을 적용시킨것 같은데 동작이 안되어서 위와 같은 이유로 질문을 드립니다.

항상 좋은 강의를 해 주셔서 감사합니다!

답변 7

·

답변을 작성해보세요.

2

제 강의 내용 그대로 해봤으나 여전히 잘 동작하고 있습니다. SSL 설정이 제대로 안된경우에 http2 요청을 보내더라도 http/1.1로 응답하는 경우가 있기는 한데, 맨 처음 질문 주신 글을 보면 SSL도 잘 설정이 된걸로 보이는데 흠.. 이상하네요. 

죄송하지만 모르겠네요. 보여주신 의존성 설정과 application.properties에서는 이상한 점을 찾을 수가 없습니다.

저도 동일하게 스프링 부트 2.3.4를 사용했으며 다른거라면 저는 자바 11을 썼다는것 정도인데 수업 영상에서는 1.8을 쓰고 있으니 자바 버전과는 관계 없는 문제로 보입니다.

0

gilmat님의 프로필

gilmat

질문자

2020.10.26

감사합니다. 다시 한번 강의 내용 그대로 시도를 해보겠습니다!

0

gilmat님의 프로필

gilmat

질문자

2020.10.26

해당 결과입니다.

0

curl 로 확인해보신 내용 커맨드 입력한 내용과 결과좀 붙여 넣어 주시겠어요?

0

gilmat님의 프로필

gilmat

질문자

2020.10.26

넵 curl을 이용하여 실행을 시켰을때도 http2가 아닌 http1.1로 결과가 나오기 때문에 질문을 드렸습니다. spring docs를 보아도 undertow는 따로 설정이 필요 없다고만 나와 있는데 이유를 모르겠습니다..

0

아.. HTTPS 적용이 안된다는 질문으로 착각했네요. 콘솔에서 CURL을 사용해서 http2 요청으로 보내보셨나요? 

0

동작이 된거 아닌가요? 8443으로 https /hello 요청을 보냈고 응답으로 hello 메시지를 받은걸로 보이는데요.