Reputation: 888
Here is the basic architecture I currently use to deliver access to web application (AngularJS on the front-end - JEE-JAX-RS for the back-end REST API):
Client -> Apache -> Application server (Java container - ex. tomcat)
The client browser connect to the application through HTTPS (handled by Apache) and Apache forwards the connection to the Java container (I'm using Oracle Weblogic). Everything works fine. But now I'd like to use HTTP/2.
Apparently, HTTP/2 will be available only in JEE8 (Servlet v4) which means it will not be available in solution like Weblogic before a loooong time.
Actually I have two questions :
Upvotes: 2
Views: 4238
Reputation: 874
Yes, you can activate mod_http2 in httpd.conf file in Apache24/conf folder. You also need to enable the following modules: 1. mod_log_config 2. mod_setenvif 3. mod_ssl 4. socache_shmcb_module You have to include the httpd-ssl.conf file in your httpd.conf file by uncommenting the line -- include /extra/httpd-ssl.conf Include the certificate and key in the conf folder and set their paths in the https-ssl.conf file The above steps will enable HTTP/2 in Apache 2.4
You can enable HTTP/2.0 for your Java Application hosted on Tomcat by installing Tomcat-9. Tomcat-9 supports HTTP/2.0 and server push services.
You can redirect your Requests from Apache 2.4 to Tomcat 9 using the instructions in the below link https://www3.ntu.edu.sg/home/ehchua/programming/howto/ApachePlusTomcat_HowTo.html
Using these steps you can enable HTTP/2.0 to work between client browser, Apache and your Java Application. You will get the full benefits of HTTP/2.0 in this way.
I have already implemented all the above steps in my Project and getting full rewards of high performance in communication.
If you have any doubts you can leave your comments here.
Upvotes: 2
Reputation: 18497
Apache (and Nginx) do not currently have the capability to work in reserve-proxy mode and communicate to the backend using HTTP/2.
When you have such "mixed" communication (browser to Apache in HTTP/2 and Apache to backend in HTTP/1.1 or AJP) you are losing a number of optimizations that HTTP/2 brings, in particular multiplexing and HTTP/2 push, not to mention the overhead due to translating the request from HTTP/2 to HTTP/1.1 and viceversa.
HTTP/2 is already available in the Java world: Jetty (I am the Jetty HTTP/2 lead), Undertow and Netty already provide transparent HTTP/2 support so that you just deploy your JEE application, enable HTTP/2 and it's done.
Because of these limitations of Apache and Nginx, we currently recommend to use HAProxy in front of Jetty (as explained in details here). This configuration will give you the maximum benefit for HTTP/2: fast TLS offloading performed by HAProxy, powerful load balancing, very efficient communication with the backend (no translation to HTTP/1.1), with HTTP/2 everywhere and therefore all its benefits.
Jetty also offers an automatic HTTP/2 push mechanism, which is not available, to my knowledge, in Apache or Nginx.
Specifically for your questions:
mod_http2
so that browser and Apache will communicate via HTTP/2, but you may lose HTTP/2 Push. Communication with the backend will use HTTP/1.1, however. This will work but it's not an optimal HTTP/2 deployment.Upvotes: 4