httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Shevett <shev...@pobox.com>
Subject [users@httpd] Httpd vhosts and ProxyPass/ProxyPassReverse and AJP - am I on crack?
Date Mon, 26 Nov 2012 19:37:03 GMT
I'm beginning to wonder if what I'm trying to do Just Doesn't Make 
Sense.  After banging my head on this for 2 weeks, I'm asking the hive 
mind for help.

I have an Apache Tomcat-based application that runs on as the only app 
on a particular Tomcat server.  Each server services an individual 
client.  When I have a new client, I spin a new server (this is actually 
in EC2, so this is very easy to do).

The tomcat application runs on the 'middle tier', and is fronted by an 
Apache HTTP server that has a single exposed IP, and proxies connections 
back to the appserver.

So far so good.

The problem is I want to have subdirectories within the initial URL map 
to different back end servers.  IE:
http://FOO.com/a/ <-- goes to server 'app01'
http://FOO.com/b/ <-- goes to server 'app02'

And so on.  The problem is I can't figure out what magic incantations to 
put in httpd.conf to make this work. Note that I have working vhosts 
answering subdomain requests, and proxying back correctly - like this one:

<VirtualHost *:80>
         ServerName m.FOO.com
         ProxyPreserveHost On
         ProxyPass / ajp://10.211.42.48:8009/
         ProxyPassReverse / ajp://10.211.42.48:8009/
</VirtualHost>

But I'm trying to change this so FOO.com/something/ goes somewhere 
different than FOO.com/somethingelse/

Here's what I have now, and it's not working correctly.

<VirtualHost *:80>
         ServerName www.FOO.com
         ServerAlias FOO.com

         ProxyRequests Off

         # Working, live production host:
         ProxyPass /a/ ajp://10.211.42.48:8009/
         ProxyPassReverse /a/ http://FOO.com/

         # app test host
         ProxyPass /c/ ajp://10.122.95.146:8009/
         ProxyPassReverse /c/ http://FOO.com/
</VirtualHost>

The first Proxy configuration is working correctly.  Requests coming 
into /a/ go to the server on 10.211.42.48.  No worries.  But hitting the 
second address will end me back up at /a/ - I'm guessing because there 
are essentially two ProxyPassReverse's for the same url (http://FOO.com).

Is this configuration even possible using ProxyPass and 
ProxyPassReverse?  Should I reconfigure this to use mod_rewrite and use 
[P] rules?  An initial stab at that failed, but if that's where I should 
go I'll use it.

Help please?

-- 
Dave Shevett
shevett@pobox.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message