Tomcat support for HTTP/2.0?
Asked Answered
Y

4

47

Does anyone know what is the lowest version of Tomcat that supports HTTP/2.0? I've been looking everywhere on their site and I cannot find any details regarding this.

Yourself answered 15/6, 2015 at 21:30 Comment(0)
H
71

I'm the HTTP/2 implementer in Jetty, and I watch out other projects implementing HTTP/2.

Tomcat's Mark Thomas has outlined support for HTTP/2 for Tomcat 9.

Update Jan 2017: Tomcat 8.5 supports HTTP/2 see @joe-aldrich answer https://mcmap.net/q/360669/-tomcat-support-for-http-2-0

Considering that Servlet 4.0 is going to have as a target HTTP/2 support, and that HTTP/2 support requires ALPN support in the JDK (which also I am involved in), and that ALPN support in the JDK is scheduled for JDK 9, it is probably going to be a long time before all that materializes.

However, be aware that other Servlet Containers already provide HTTP/2 support.

Jetty 9.3.0 has full, robust, support for HTTP/2, client and server. We have been running HTTP/2 on our own website for many months now, and we consider HTTP/2 support production ready. Jetty's HTTP/2 Push APIs are being considered for inclusion in Servlet 4.0. HTTP/2 Push is already available to applications deployed to Jetty in a transparent way (via a Servlet Filter).

Undertow also has an implementation for HTTP/2.

Netty also has one, but it's not based on the Servlet APIs.

Hirundine answered 15/6, 2015 at 22:29 Comment(1)
In order to use HTTP/2 with Tomcat you must enable HTTPS as mentioned in the links above. Here is a simple guide on how to do it: readlearncode.com/configure-tomcat-9-for-http2Isar
D
24

Tomcat 8.5 has been released with features back-ported from Tomcat 9 and includes HTTP/2 support.

Demarcate answered 17/6, 2016 at 20:26 Comment(5)
AFAIK, Tomcat 8.5 support of HTTP/2 is based on Tomcat Native.Dollhouse
Using h2 in Tomcat 8.5 with the NIO or NIO2 connectors currently does still require using OpenSSL for TLS. However, Tomcat 8.5 also supports clear text h2c which would not require Tomcat Native for OpenSSL (though browsers have presently chosen not to implement h2c support).Demarcate
native? does that mean that the embedded tomcat on spring boot wont be able to deliver http2?Adnah
Tomcat Native is an optional component for Tomcat. I believe it can be used with Spring Boot by configuring the APRLifecycleListener. You may want to check out Spring Boot issue #7376 on Github which references using APR with Embedded Tomcat on Spring Boot (including a link to a configuration example for the APRLifecycleListener). github.com/spring-projects/spring-boot/issues/7376Demarcate
You don't need to configure anything, if libapr and libcrypto and libssl and libcnative are found in the LD_LIBRARY_PATH, you can use http2 (if you enable it in the application.properties with server.http2.enabled=true)Novokuznetsk
I
14

The latest version of Tomcat (version 9) fully supports HTTP/2. However, as all major browsers only implement HTTP/2 over TLS you will need to configure Tomcat to allow this. This article explains TLS configuration in Tomcat, but here's the summary.

Open the conf/server.xml file and make the following configuration changes.

<Connector port="8443"
  protocol="org.apache.coyote.http11.Http11AprProtocol"
  maxThreads="150" SSLEnabled="true">
    <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/>
    <SSLHostConfig honorCipherOrder="false">
        <Certificate certificateKeyFile="conf/ca.key"
          certificateFile="conf/ca.crt"/>
    </SSLHostConfig>
</Connector>
Isar answered 23/7, 2017 at 11:46 Comment(4)
Would it still work if Tomcat is configured with http only (on the http connector port 8080) and we use Apache web server to deliver the https?Adolfo
Can we use HTTP2 in tomcat without APR? With Nio?Hotien
@Adolfo did you ever figure out an answer to your question above? We have same setup where we run Tomcat over HTTP and proxy it with Apache HTTP or Cloudfront. > Would it still work if Tomcat is configured with http only (on the http connector port 8080) and we use Apache web server to deliver the https?Trimester
I just ran into this as well, and on Cloud Run, I was able to configure it by dropping the <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> inside the port 8080 connector.Danita
A
0

After automatic update of Tomcat v.9 the https is not working any more i solved it commenting following line in server.xml

<!--<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> -->
Assailant answered 16/10, 2023 at 9:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.