up vote 0 down vote favorite
share [g+] share [fb]

I have this architecture:

            http                   Ajp
[Apache A] -------> [Apache B] ----------> [Tomcat]

there is a way to configure [Apache B] to forward an ajp request in order to achive this:

             Ajp                  Ajp
[Apache A] -------> [Apache B] ----------> [Tomcat] 

???

many thanks in advance.

link|improve this question
feedback

2 Answers

You need mod_proxy_ajp, which adds ajp support to mod_proxy.

link|improve this answer
I know how to forward an http request on the ajp channel. But how configure [Apache B] to catch the ajp incoming connection? Can you give me an example? – user40747 Apr 16 '10 at 14:15
feedback

You can setup a reverse proxy on Apache A, so that all requests for your app go to Apache B with a config like:

ProxyPass /myapp http://apacheb.domain.com/myapp
ProxyPassReverse /myapp http://apacheb.domiain.com/myapp

Then, using ModJK on Apache B, you set up a workers.properties file to define your tomcat servers and any load-balancing and connection parameters. In your vhost block, you set JKmounts to the tomcat server. So, if you have www.domain.com/myapp as a tomcat application, you would do

jkmount /myapp/* worker1

Where worker1 would be defined in the workers.properties file like:

worker.worker1.port=8009
worker.worker1.host=tomcat_host_name
worker.worker1.type=ajp13

So the request will come in to apache A, which will get proxied to B and then mod_jk'ed over to the tomcat server.

link|improve this answer
i'm forced to do this. there's a firewall between the two apache and the only connection that I can establish is to the second apache, and obviously i cannot change the firewall configuration – user40747 Apr 16 '10 at 15:53
Ok. In that case, I think the first scenario is going to be the best bet. Set up a mod_proxy from A->B, so that everything gets proxied to Apache B. So all A is doing is acting as a gateway for everything to B. Then setup ModJK (or mod_proxy_ajp if you prefer) from Apache B to the tomcat server. Since everything is effectively proxied twice, there were most certainly be some performance impact with this. – Alex Apr 16 '10 at 16:24
I have modified my answer to reflect what I was talking about in my last comment. I have not tried a setup like this, but I think this will work. – Alex Apr 16 '10 at 16:40
feedback

Your Answer

 
or
required, but never shown

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