This repository demonstrates Undertow configuration for HTTP/2 for both outbound and inbound connections.
In the build.gradle JavaExec tasks are decorated to include the alpn-boot JAR on
the bootstrap classpath.
In theory (see curl example) HTTP/2 should work between application after enabling protocol upgrade to it
(a Tomcat 8.5 could do that without the ALPN bootstrap),
but browsers does not supports it on unencrypted channel.
The web server will listen on 8080 (http) and 8443 (https) ports,
the 'test' page is accessible on/test path.
- Java 8 (jdk1.8.0_111)
- Start applicaiton from the command line
$ gradlew bootRun
- NOTICE: this version of ALPN is compatible with jdk1.8.0_111.
For compatibility list, check out ALPN documentation.
Get the compatible JAR from any Maven repository, place it in the project root
and update
build.gradleJavaExec task collection config. - Check HTTP/2 on http://localhost:8080/test and https://localhost:8443/test
Well, curl test on Windows not produced the results I was hoping:
$ curl http://localhost:8080/test --http2 -s | grep inbound | head -1
<p>inbound http/2: false</p>
$ curl https://localhost:8443/test --http2 -s -k | grep inbound | head -1
<p>inbound http/2: true</p>
I thought curl will be able to use HTTP/2 without TLS, but seems like that is not the case.