Re: question about using a proxy with mod_perl

2002-10-18 Thread Lyle Brooks
I believe that the Rewrite rule matches only the document root portion
of the URL.

So for a request

   http://a.blah.com/mypath/mypage.html

All you will get to match on is this much

/mypath/mypage.html

To do what you are trying to do, I believe you'll need to use some RewriteCond
directives, something like (read: I'm just doing this from memory, you'll
need to test)...

RewriteCond %{HTTP_HOST} ^b
RewriteRule ^/(.*) http://b.blah.com:4374/$1  [P,L]


Hope that helps or points you in the right direction.

Quoting Brian Hirt ([EMAIL PROTECTED]):
> 
> I have a question about setting up a proxy for a mod_perl server.  I've
> got a simple proxy set up that listens on port 80 and proxies to the
> mod_perl server running on a different port.  
> 
> For example. http://blah.blah.com/anything/ will go to
> http://blah.blah.com:4374/anything/  and the rules to do that are below.
> 
> RewriteEngine on
> RewriteLogLevel   0
> RewriteRule   ^/(.*)$  http://blah.blah.com:4374/$1   [P,L]
> NoCache   *
> ProxyPassReverse  /  http://blah.blah.com/
> 
> This is fine when you are proxying a single machine name, but how would
> i set up a proxy that would send http://a.blah.com ->
> http://a.blah.com:4374,  http://b.blah.com -> http://b.blah.com:4374,
> etc etc etc.  There are about 40 different names that need to be
> proxied, and it's important that the destination name is the same as the
> source machine name.
> 
> It seems like something like 
> RewriteRule   ^http://([^.]+).blah.com/(.*)$   http://$1.blah.com:4374/$2
> [P,L] 
> 
> should work, but it doesn't.
> 
> -- 
> Brian Hirt <[EMAIL PROTECTED]>



Re: question about using a proxy with mod_perl

2002-10-18 Thread Charlie Garrison
Good afternoon,

On 17/10/02 at 2:46 PM, Lyle Brooks <[EMAIL PROTECTED]> wrote:

>To do what you are trying to do, I believe you'll need to use some RewriteCond
>directives, something like (read: I'm just doing this from memory, you'll
>need to test)...
>
>RewriteCond %{HTTP_HOST} ^b
>RewriteRule ^/(.*) http://b.blah.com:4374/$1  [P,L]
>

I don't think the RewriteCond is needed. I just use something like the following
to proxy all files ending in .cgi:

RewriteRule ^/(.*).cgi(.*)$http://%{HTTP_HOST}:8001/$1.cgi$2 [P]

I also have lots of domain names that need to get passed to the back-end server.
My setup gets even more fun when taking into account the internal NAT addresses
that are needed for proxying but local dns serves public external addresses. I
had a fun weekend learning about views and acl's in bind to get around that
problem. (And then patching output from oDNS to support it.)


Charlie
-- 
   Charlie Garrison[EMAIL PROTECTED]
   PO Box 141, Windsor, NSW 2756, Australia 



question about using a proxy with mod_perl

2002-10-18 Thread Brian Hirt

I have a question about setting up a proxy for a mod_perl server.  I've
got a simple proxy set up that listens on port 80 and proxies to the
mod_perl server running on a different port.  

For example. http://blah.blah.com/anything/ will go to
http://blah.blah.com:4374/anything/  and the rules to do that are below.

RewriteEngine on
RewriteLogLevel   0
RewriteRule   ^/(.*)$  http://blah.blah.com:4374/$1   [P,L]
NoCache   *
ProxyPassReverse  /  http://blah.blah.com/

This is fine when you are proxying a single machine name, but how would
i set up a proxy that would send http://a.blah.com ->
http://a.blah.com:4374,  http://b.blah.com -> http://b.blah.com:4374,
etc etc etc.  There are about 40 different names that need to be
proxied, and it's important that the destination name is the same as the
source machine name.

It seems like something like 
RewriteRule ^http://([^.]+).blah.com/(.*)$   http://$1.blah.com:4374/$2
[P,L] 

should work, but it doesn't.

-- 
Brian Hirt <[EMAIL PROTECTED]>