Forum Moderators: phranque

Message Too Old, No Replies

Help with Proxy or Pass Through

mod_proxy mod_rewrite

         

Boston444

6:56 pm on Oct 18, 2011 (gmt 0)

10+ Year Member



Hi Everyone,
I am a bit new when it comes to using Passproxy or Passthrough with Mod_Rewrite. Below is my situation. Any help would be appreciated. I am not sure if I need to use rewrites or can use the proxy.


I have 10 websites, all setup in the same manner:

Webserver --> Application Server --> Database.

The webserver uses name based virtual hosts and pass all traffic to the application server via the following entry:

<IfModule mod_proxy.c>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / ajp://internalAppIP:8009/
ProxyPassReverse / ajp://internalAppIP:8009/
</IfModule>

My issue is that now I have a second web server that will handle certain requests depending on the URL structure. How can I tell the receiving web server to forward/proxy particular requests to this other web server. Both webservers will communicate with each other via internal network.



www.aaa.com/blog --> Proxy/Pass to Webserver2
www.aaa.com --> continue to app server

www.ccc.com/blog --> Proxy/Pass to other Webserver2
www.ccc.com --> continue to app server

www.ccc.com/blog --> Proxy/Pass to other Webserver2
www.ccc.com --> continue to app server

I thought I could use something like this but it only dumps the request to the root of the second web server and doesn't seem to use the name based virtual hosting.

ProxyPass /blog [WebServer2_InternalIP:80...]
ProxyPassReverse /blog [WebServer2_InternalIP:80...]

Webserver2 has a directory structure of:

/var/www/html/aaa
/var/www/html/bbb
/var/www/html/ccc

But the redirects are hitting the index page at:

/var/www/html/

I thought Webserver2 would see the header file and use continue to use name based hosting and direct the request to the correct folders. Any ideas?