Tomcat – Apache mod_proxy with Tomcat 8.5 using http2

apache-2.4http2mod-proxytomcat

Is it possible to use mod_proxy in front of an Apache Tomcat 8.5 with the http2 protocol? If yes it would be nice to see an example configuration.

Edit

Specifically: Is it possible and recommended to use http2 between the client and the server (Apache httpd), and continue the data stream with ajp between Apache httpd and Apache Tomcat?

Edit 2

This answer provides some details about the topic:

https://stackoverflow.com/questions/35697681/can-we-use-apache-to-deliver-http-2-connection-for-a-java-application-server

Best Answer

Apache httpd added HTTP/2 proxy support from 2.4.21 but suggest you run latest (2.4.27 at time of writing) as this module is still changing quite a bit at the moment.

Tomcat has just added HTTP/2 support in Tomcat 9: https://readlearncode.com/configure-tomcat-9-for-http2/

So in theory this should all fit together nicely if you're willing to upgrade to those versions (and install OpenSSL 1.0.2 or above required for HTTP/2).

However, in practice it's still all very new, so bugs are possible. To be perfectly honest, the biggest gains from HTTP/2 are with higher-latency connections like client-to-server. Server-to-server connections like Apache to Tomcat using mod_proxy will see fewer gains.

So, given how new these are, you may wish to just use HTTP/2 on your Apache web server (or any other web server which supports HTTP/2), and use mod_proxy to connect to Tomcat via HTTP/1.1 or AJP. This will give you most of the performance gains of HTTP/2 without the hassle and risk of upgrading everything to get full end-to-end HTTP/2.