Help setting up a proxy, ServerName redirect causing problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



7I need to proxy requests coming into one virtualhost over to another virtual host on the same server. I've done this before but can't get it working with these two virtualhosts. It works as long as I always request the site with the trailing slash.

But when I make a request without the trailing slash (like follow a link on a page to the /images directory), the final destination site issues a redirect, using its own ServerName, so then the user's browser tries to go there, which of course it cannot reach.

I thought these rewrite lines would fix it, but they don't.
RewriteEngine On
RewriteRule    ^/(.*)$               to://http://finalDestinationSite/$1
RewriteRule    ^to://([^/]+)/(.*)    http://$1/$2   [E=SERVER:$1,P,L]
RewriteRule    .*  -  [F]

Here is the full vhost block:

<VirtualHost 192.168.1.4>
 ServerName externalSiteName
 ProxyRequests Off

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

 RewriteEngine On
 RewriteRule    ^/(.*)$               to://http://finalDestinationSite/$1
 RewriteRule    ^to://([^/]+)/(.*)    http://$1/$2   [E=SERVER:$1,P,L]
 RewriteRule    .*  -  [F]

ProxyPass / http://finalDestinationSite (I've tried this with and without a trailing slash)
</virtualhost>


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux