Thursday, November 22, 2018

Using Apache 2.4 Reverse Proxy to some (but not all) Tomcat/JavaEE Applications

Usually if you have a couple of Tomcat WAR's (Java WEB applications) deployed on a Tomcat Servlet Container, you a couple of options when exposing those applications through an Apache (or NGINX) http server.

Server Setup is laid out in the following pic:

Server Layout

For the sake of this discussion, let's assume we have these WAR applications deployed in Tomcat server (besides ROOT and manager default applications):

c. If your Location sections contains more configuration options (RequestHeader directives, Require, Auth Type) then your COPY+PASTE gets bigger every time, and if you need to change/add something, you will need to do it in every single configuration you have done before.

Option 3)

My favorite option nowadays.

If you want the three same applications exposed, you can use LocationMatch and ProxyPassMatch directives to get the best of both previous options:

<LocationMatch "^/tomcat/(?<apiurl>(users|webapp|clubs)/.*)">

ProxyPassMatch ajp://192.168.0.2:8009/$1

</LocationMatch>

You use a regular expression to filter what domains will go through to tomcat server, and you keep it only in one configuration.

3 comments:

My first online casino solely best casino in which I played. Just want to highlight a very beautiful design and convenience and beauty in all games. The presence of public tables testifies first of all to casino honesty - nobody twists the roulette wheel specially - at least =).

The effect on expenses related with diminished inventories is most articulated in enterprises where the item has a limited timeframe of realistic usability (for example bananas), is liable to quick mechanical out of date quality or value decreases (for example PCs), or where there is a fast progression of new items (for example books, music). prywatnoscwsieci.pl