Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The setup I am trying to put together consists on a server connected to the internet (a redhat box) and 2 Apache Tomcat boxes not connected to the internet.

Let's call the server Server and the two Apache Tomcats, Apache1 and Apache2.

So, assuming my external IP is, Apache1 is and Apache2 is, what I'm trying to configure is a reverse proxy so that if the request goes into it will be directed to Apache1 and if the request goes into it will be forwarded to Apache2.

Now, I don't need a cache on the proxy since there is application sitting in those tomcats and each request needs to get a fresh answer.

I searched for a while and I tried building this with Squid but i can't get it to work the way I need it.

Anyone knows how to do this? What software do I need? How do I configure the reverse proxy?



EDIT: Maybe I am better using mod_jk or mod_proxy to do this? I mean, can I have Apache install in Server and redirect the requests to Apache1 and Apache2 (Tomcat)?

share|improve this question
up vote 2 down vote accepted

Jessica, as you suggested in your edit, you can definitely use mod_proxy to do this. You would install Apache HTTPD on the server with the external IP and configure the reverse proxy to pass requests based on Locations defined in the httpd.conf file.

I really like this page as it gives an in-depth discussion of this topic while being a bit more helpful than just reading the configuration reference.

I suspect you can possibly configure mod_jk to do this, but I have not attempted that.


LoadModule proxy_module modules/

ProxyRequests Off
<Proxy *>
  Order deny,allow
  Allow from all

ProxyPass /mywebserver1
ProxyPass /mywebserver2
ProxyPassReverse /mywebserver1
ProxyPassReverse /mywebserver2

You should read the httpd docs about ProxyPass and ProxyPassReverse directives. The ProxyPassReverse is especially interesting as it is a critical part of "cleaning up" the proxied traffic so that the apps being proxied don't have to know that they're being proxied. You may also be interested in mod_proxy_html

share|improve this answer
Thanks. Let met see if I can figure it out. However, if you do have a small sample of the config for what I wrote in the question it'll be very helpful. – jessica May 25 '10 at 15:06
Jessica- updated the answer with an example config. Hope this helps. – Clint Miller May 25 '10 at 15:44
Thanks! do i need to enable ajp (in /etc/httpd/conf.d/proxy_ajp.conf) – jessica May 25 '10 at 17:56
No need to enable AJP unless you want to configure Apache httpd to talk to your Tomcat backends with the AJP protocol (instead of HTTP). That could be a possibility, but it's not what we've been discussing in this answer. – Clint Miller May 25 '10 at 18:52
I need to be able to connect to an application (a java app) on the Tomcat server. I tried what you wrote and also with AJP and it's not working. I can access the tomcat directly but not via the apache proxy. it just times out. or it gives me a 503 error – jessica May 25 '10 at 19:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.