Chapter 5. Enabling HTTP/2 for the Red Hat JBoss Web Server The Hypertext Transfer Protocols (HTTP) are standard methods of transmitting data between applications, such as servers and browsers, over the internet. JBoss Web Server supports the use of HTTP/2 for encrypted connections that are using Transport Layer Security (TLS), which is indicated by the h2 keyword when enabled. HTTP/2 improves on HTTP/1.1 by providing the following enhancements: Header compression omits implied information to reduce the size of the header that is transmitted. Multiple requests and responses over a single connection use binary framing rather than textual framing to break down response messages. Note JBoss Web Server does not support the use of HTTP/2 for unencrypted connections that are using the Transmission Control Protocol (TCP), which is indicated by the h2c keyword when enabled. 5.1. Prerequisites You have root user access on Red Hat Enterprise Linux. You have installed Red Hat JBoss Web Server 5.0 or later. You have installed the openssl and apr packages that are provided with Red Hat Enterprise Linux. For more information about installing the openssl and apr packages, see Red Hat Enterprise Linux package requirements . Note These operating system native libraries are also provided by jws-6.0.0-application-server- <platform> - <architecture> .zip where available. If you want to run JSSE+OpenSSL or APR on Red Hat Enterprise Linux version 8 or 9, you must use Tomcat-Native to ensure successful operation. Tomcat-Native is located in the native archive directory. You have configured a connector that supports the HTTP/2 protocol with SSL enabled. For JBoss Web Server 6.0, the following connectors support the HTTP/2 protocol: The NIO connector with JSSE + OpenSSL (JSSE) The NIO2 connector with JSSE + OpenSSL (JSSE) 5.2. Enabling HTTP/2 for a connector In the server.xml file, the upgrade protocol in the connector definition is already set to HTTP/2 by default. Procedure Open the JWS_HOME /tomcat/conf/server.xml configuration file. In the connector definition, ensure that the UpgradeProtocol class name is set to org.apache.coyote.http2.Http2Protocol . For example: <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" maxParameterCount="1000"> <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> <SSLHostConfig> <Certificate certificateKeystoreFile="conf/localhost-rsa.jks" certificateKeystorePassword="changeit" type="RSA" /> </SSLHostConfig> </Connector> To apply any configuration updates, restart the Red Hat JBoss Web Server as the root user. To restart JBoss Web Server on Red Hat Enterprise Linux by using systemd , enter the following command: To restart JBoss Web Server on Red Hat Enterprise Linux by using startup.sh , enter the following commands: To restart JBoss Web Server on Microsoft Windows, enter the following command: 5.3. Viewing JBoss Web Server logs to verify that HTTP/2 is enabled You can view the JBoss Web Server console output log to verify that HTTP/2 is enabled. Prerequisites You have enabled HTTP/2 for a connector . Procedure To view the console output log, enter the following command: Note In the preceding command, replace JWS_HOME with the top-level directory for your JBoss Web Server installation. Verification If HTTP/2 is enabled, the command produces the following type of output that indicates the connector has been configured to support negotiation to [h2] : 5.4. Using the curl command to verify that HTTP/2 is enabled You can use the curl command-line tool to verify that HTTP/2 is enabled. Prerequisites You have enabled HTTP/2 for a connector . You are using a version of curl that supports HTTP/2. To check that you are using a version of curl that supports HTTP/2, enter the following command: This command produces the following type of output: Procedure To check that the HTTP/2 protocol is active, enter the following command: Note In the preceding example, replace <JBoss_Web_Server> with the URI of the modified connector, such as example.com . The port number is dependent on your configuration. Verification If the HTTP/2 protocol is active, the curl command produces the following output: Otherwise, if the HTTP/2 protocol is inactive, the curl command produces the following output: 5.5. Additional resources (or steps) For more information about using HTTP/2, see Apache Tomcat 10 Configuration Reference: The HTTP Connector - HTTP/2 Support . For more information about the HTTP/2 Upgrade Protocol and the supported attributes, see Apache Tomcat 10 Configuration Reference: The HTTP2 Upgrade Protocol . For more information about the proposed internet standard for HTTP/2, see IETF: RFC 7540 - Hypertext Transfer Protocol Version 2 (HTTP/2) .

Commands:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" maxParameterCount="1000"> <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> <SSLHostConfig> <Certificate certificateKeystoreFile="conf/localhost-rsa.jks" certificateKeystorePassword="changeit" type="RSA" /> </SSLHostConfig> </Connector>
systemctl restart jws6-tomcat.service
JWS_HOME /sbin/shudown.sh JWS_HOME /sbin/startup.sh
net restart tomcat10
cat JWS_HOME /tomcat/logs/catalina.out | grep 'h2'
06-Apr-2018 04:49:26.201 INFO [main] org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The [" connector_name "] connector has been configured to support negotiation to [h2] via ALPN
curl -V
curl 7.55.1 (x86_64-redhat-linux-gnu) Release-Date: 2017-08-14 Protocols: dict file ftp ftps gopher http https Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy Metalink PSL
curl -I http:// <JBoss_Web_Server> :8080/
HTTP/2 200
HTTP/1.1 200