You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ryan Stille <ry...@cfwebtools.com> on 2008/02/18 23:20:24 UTC

[users@httpd] Help setting up a proxy, ServerName redirect causing problems

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


Re: [users@httpd] Help setting up a proxy, ServerName redirect causing problems

Posted by Ryan Stille <ry...@cfwebtools.com>.
Eric Covener wrote:
> On Feb 18, 2008 5:20 PM, Ryan Stille <ry...@cfwebtools.com> wrote:
>   
>> 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.
>>     
>
> ProxyPassReverse
>
>   

Excellent, I have it working now.  Thank you,

-Ryan


---------------------------------------------------------------------
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] Help setting up a proxy, ServerName redirect causing problems

Posted by Eric Covener <co...@gmail.com>.
On Feb 18, 2008 5:20 PM, Ryan Stille <ry...@cfwebtools.com> wrote:
> 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.

ProxyPassReverse

-- 
Eric Covener
covener@gmail.com

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