Skip to content

Instantly share code, notes, and snippets.

@lzcjames
Created May 27, 2020 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lzcjames/b3a93aa5778a8c8fe056b12c9fc5b401 to your computer and use it in GitHub Desktop.
Save lzcjames/b3a93aa5778a8c8fe056b12c9fc5b401 to your computer and use it in GitHub Desktop.
http2 in JBoss

Analyze HTTP/2 issues when deploying Showcase in JBoss EAP 7.2.4.GA

HTTP/2 VS HTTP/1.1

cf. Blog: HTTP/2 VS HTTP/1.1 cf. Doc: Documentation HTTP/2

Subsystem Undertow

In JBoss EAP 7, the undertow subsystem allows you to configure web server and servlet container settings. cf. Doc: JBoss 7.2 config undertow

Configuring HTTP/2

The protocol HTTP/2 has two identifiers:

  • h2 The string h2 corresponds to HTTP/2 over TLS (protocol negotiation via ALPN).
  • h2c The string h2c corresponds to HTTP/2 over cleartext TCP, it is used to upgrade cleartext HTTP/2 from HTTP/1.1 , not need ALPN.

cf. Wiki: HTTP/1.1 used with HTTP/2 cf. Doc: HTTP/2 Version Identification

If we want to upgrade HTTP/1.1 to cleartext HTTP/2, enable HTTP/2 in the HTTP listener in Undertow. Don't need a https certificate neither ALPN.

<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>

The client starts an HTTP/1.1 connection and sends an Upgrade: h2c header. If the server supports HTTP/2, it replies with HTTP 101 Switching Protocol status code. The HTTP Upgrade mechanism is used only for cleartext HTTP2 (h2c).

If we want to use HTTP/2 over TLS in the HTTPS listener, enable it in Undertow:

<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment