Enable HTTP 2.0 for Undertow in Spring Boot

I wonder how I can enable HTTP 2.0 for Undertow using Spring Boot, I controlled the protocol, and currently HTTPS uses 1.1.

Is there any property for this? Or should I create an EmbeddedServletContainerFactory with this option.

Tks

+5
source share
1 answer

You need to add the following bean configuration

@Bean UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() { UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory(); factory.addBuilderCustomizers( builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); return factory; } 

Then run the application using alpn-boot-8.1.9.v20160720.jar in the path to the boot class

 java -Xbootclasspath/p:<<location>>/alpn-boot-8.1.9.v20160720.jar -jar <<your application>> 
+5
source

Source: https://habr.com/ru/post/1236464/


All Articles