You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Krist van Besien <kr...@gmail.com> on 2005/07/04 12:33:33 UTC

Re: [users@httpd] RewriteRule question: forward requests from one Apache server to another

On 6/29/05, Cameron Beattie <kj...@orcon.net.nz> wrote:
> For those interested, I ended up using different ports to achieve the
> desired result. There may be a better way but this works for me:

Good that it works now, but your original setup would have worked had you added:

ProxyPreserveHost On

to your config.

WIth this option the original "Host" header is preserved, and the
internal server can than select the correct virtual host based on it.

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


Re: [users@httpd] RewriteRule question: forward requests from one Apache server to another

Posted by Cameron Beattie <kj...@orcon.net.nz>.
Thanks for the tip. I prefer that way. The final config is:
Server 1
NameVirtualHost *:80

<VirtualHost *:80>
        ServerName server.mydomain.com
        ProxyPreserveHost On
        RewriteEngine On
        RewriteRule ^/(.*) http://60.234.nnn.nn:8008/$1 [L,P]
</VirtualHost>
<VirtualHost *:80>
        ServerName otherserver.mydomain.com
        ProxyPreserveHost On
        RewriteEngine On
        RewriteRule ^/(.*) http://60.234.nnn.nn:8008/$1 [L,P]
</VirtualHost>

Server2
NameVirtualHost *:8008

<VirtualHost *:8008>
        ServerName server.mydomain.com
        DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:8008>
        ServerName otherserver.mydomain.com
        DocumentRoot /var/www/html2
</VirtualHost>

Hope this helps someone.

Cameron

----- Original Message ----- 
From: "Krist van Besien" <kr...@gmail.com>
To: <us...@httpd.apache.org>; "Cameron Beattie" <ex...@appsfarm.com>
Sent: Monday, July 04, 2005 10:33 PM
Subject: Re: [users@httpd] RewriteRule question: forward requests from one 
Apache server to another


On 6/29/05, Cameron Beattie <kj...@orcon.net.nz> wrote:
> For those interested, I ended up using different ports to achieve the
> desired result. There may be a better way but this works for me:

Good that it works now, but your original setup would have worked had you 
added:

ProxyPreserveHost On

to your config.

WIth this option the original "Host" header is preserved, and the
internal server can than select the correct virtual host based on it.

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




---------------------------------------------------------------------
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