httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Stille <r...@cfwebtools.com>
Subject [users@httpd] Help setting up a proxy, ServerName redirect causing problems
Date Mon, 18 Feb 2008 22:20:24 GMT
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message