3

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

yglodt
  • 245
  • 3
  • 8

2 Answers2

5

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.

AndrewF
  • 103
  • 3
Barry Pollard
  • 4,591
  • 15
  • 26
1

As of July 2017, Apache mod_proxy doesn't support HTTP/2.0 protocol. There is a mod_proxy_http21 module but it is still experimental.

Like detailed in the StackOverflow answer provided in the second edit, you could use mod_http2 to enable HTTP/2.0 support on Apache side, and communicate back to the Tomcat server either with HTTP/1.1 or AJP. But you would loose one of HTTP/2.0 biggest feature: multiplexing.

iMax-pp
  • 11
  • 2