httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Merrell <ryanmerr...@gmail.com>
Subject [users@httpd] Struggling with Reverse Proxy Configuration for Server with multiple subdomains
Date Thu, 14 Mar 2013 16:15:32 GMT
Our web application (an LMS) uses three subdomains to serve its content:

home.example.com
training.example.com
shared.example.com

These are all vhosts running off of 1 server. My end goal is to use
mod_proxy as a reverse proxy and to load balance between two servers.
Until we can make changes to the app to be more tolerant to HA
systems, the load balancer will most likely need to be Active/Passive
between two back end servers.

I'm new to mod_proxy, so I've started off with just trying to set up a
1:1 reverse proxy, meaning one proxy server sending all traffic to one
server only. But I can't seem to get that working. Every example I can
find for setting up a reverse proxy uses examples like
"example.com/$FUNCTION" as the public side and "$FUNCTION.example.com'
as the private. For example, www.example.com/shared on the proxy goes
to shared.example.com on the private side. www.example.com/training on
the proxy goes to training.example.com on the private side. I can't do
this without considerable changes to how our application works. What i
need is for home.example.com on the proxy to go to home.example.com on
the back end. Same for shared and training.

On the proxy I tried configuring 3 vhosts (home.example.com,
shared.example.com, and training.example.com). An example is like the
following:(proxy is 192.168.2.210 and host 1 is 192.168.2.211)

NameVirtualHost 192.168.2.210:80
<VirtualHost 192.168.2.210:80>
ServerName home.example.com
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPreserveHost On

ProxyPass / http://192.168.2.211/
ProxyPassReverse / http://192.168.2.211/

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

</IfModule>
</VirtualHost>

I have the same thing for training and shared as well. Then on the
backend server, I have a standard vhost configuration for the three
vhosts (meaning if I change my dns to resolve to 192.168.2.211, the
web page functions as expected).

With this set up, and my DNS resolving to the proxy for all three
subdomains, I can pull up the few items that loads from "home", but
anything being requested from shared (training isn't used on the login
screen) gets a 404. When I look at the backend server looks, the 404
is looking in home's document root instead of Shared. So it seems that
all requests being passed to the back end server are going to the
default vhost and not based off of the Host name.Everything I can find
regarding this type of error have lead to making sure the
NameVirtualHost and VirtualHost directives match, which they do and it
still seems to go to the first vhost listed.

So a couple questions I have are
1) Is what I'm planning to accomplish even doable? I figured if it was
I'd at least be able to find just one example out on the Internet, but
I haven't been able to, which has created doubt as to whether I'm
fully understanding how mod_proxy works.
2) If it is doable, what config changes do I need to make so it uses
the hostname instead of the default vhost?
3) If I can get this part to work, am I going to have any problems in
getting an Active/Passive load balancer set up?

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


Mime
View raw message