Skip to content

Instantly share code, notes, and snippets.

@barlog-m
Created August 23, 2015 09:11
Show Gist options
  • Save barlog-m/1b102bf288f4feb2bd1b to your computer and use it in GitHub Desktop.
Save barlog-m/1b102bf288f4feb2bd1b to your computer and use it in GitHub Desktop.
Enable HTTP2 in Undertow with Spring Boot
public class SpringBootUndertowHTTP2 {
@Bean
UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
factory.addBuilderCustomizers(
builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
return factory;
}
}
@picaso
Copy link

picaso commented Oct 19, 2017

kotlin spring 2.0 with undertow

@Configuration
class ServerConfiguration {
    @Bean
    fun embeddedServletContainerFactory(): UndertowServletWebServerFactory {
        val factory = UndertowServletWebServerFactory()
        factory.addBuilderCustomizers(UndertowBuilderCustomizer { builder ->
            builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)
        })
        return factory
    }
}

@masykurm
Copy link

It didn't work for POST and PATCH method. It works for DELETE and GET. How to make it works for POST and PATCH method ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment