Configuring HTTP/2 for Tomcat 8.5 and above

Tomcat 8.5 and above support HTTP/2 (see https://tomcat.apache.org/tomcat-8.5-doc/config/http2.html).

In a standalone installation you need to configure an element UpgradeProtocol inside the Connector in server.xml:

server.xml
<Connector port="8443" protocol="..." sslImplementationName="...">
    <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/>
...
</Connector>

These properties control the generation of the server.xml configuration file.

Remark: The file generation doesn't have any logic nor it doesn't do any validation. It's just an XML replacement and adding mechanism.

Connector attributes

Property nameJava nameDefaultDescription
cargo.tomcat.connector.protocolClass
TomcatPropertySet.CONNECTOR_PROTOCOL_CLASS
HTTP/1.1
Sets the protocol of the connector, see https://tomcat.apache.org/tomcat-8.5-doc/config/http.html for details
cargo.tomcat.connector.sslImplementationName
TomcatPropertySet.CONNECTOR_SSL_IMPLEMENTATION_NAME
org.apache.tomcat.util.net.openssl.OpenSSLImplementation
The SSL implementation to be used, see https://tomcat.apache.org/tomcat-8.5-doc/config/http.html for details

UpgradeProtocol element

Property nameJava nameDescription
cargo.tomcat.connector.httpUpgradeProtocol
TomcatPropertySet.CONNECTOR_HTTP_UPGRADE_PROTOCOL
Must be org.apache.coyote.http2.Http2Protocol, if set the <UpgradeProtocol> element will be added