You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sebastian Reitenbach <it...@rapideye.de> on 2006/04/25 10:25:29 UTC

[users@httpd] proxying on virtual host name

Hi,

i have one public IP address available, and I want two http hosts behind this 
IP. With only one host, I would use virtual hosts, deciding on the used 
hostname which site to show the user as the answer. 

So with the firewall i cannot distinguish for source or destination IP 
address, as both can be for each host. So I have to redirect all incoming 
traffic to just one apache server. Is there a module available that will 
analyze the HOST information sent from the client to the server, and then 
redirect it to one or the other host?
Or is there something built into apache that can handle this on its own or any 
other way?


any suggestions are welcome.

kind regards
Sebastian


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] proxying on virtual host name

Posted by Krist van Besien <kr...@gmail.com>.
On 4/25/06, Sebastian Reitenbach <it...@rapideye.de> wrote:
> Hi,
>
> i have one public IP address available, and I want two http hosts behind this
> IP. With only one host, I would use virtual hosts, deciding on the used
> hostname which site to show the user as the answer.
>
> So with the firewall i cannot distinguish for source or destination IP
> address, as both can be for each host. So I have to redirect all incoming
> traffic to just one apache server. Is there a module available that will
> analyze the HOST information sent from the client to the server, and then
> redirect it to one or the other host?
> Or is there something built into apache that can handle this on its own or any
> other way?

You probably can do this with a rewrite:

RewriteEngine On
RewriteCond %{HTTP_HOST}   !^www\.domain2\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://server2:/$1 [P]

This will proxy every request for www.domain2.com to the server named server2.


The other way is to have two virtual hosts on your first server, just
as if both your websites ran on the same machine, and have one of the
virtual servers proxy everything to the second server.

Krist

--
krist.vanbesien@gmail.com
Solothurn, Switzerland

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org