You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by mire <mi...@modperldev.com> on 2002/05/13 16:15:25 UTC

Load Balancing, mod_proxy, rewrite problem

I have code like this:

        RewriteEngine On
 
        RewriteLog "/var/site/rewrite.log"
        RewriteMap    lb      prg:/tmp/lb

        RewriteRule  ^/trta$  http://${lb:prvi|drugi}  [proxy,last] 

and a perl script (a copy from mod_proxy manual) but it doesn't work, it seems
like perl script is waiting indeffinetly for input.

If I comment while<> line than it works but only for the first time ...

-- 


Best regards,

Miroslav Madzarevic, Senior Perl Programmer
perl@modperldev.com
Mod Perl Development http://www.modperldev.com
Telephone: +381 64 1193 501
jamph 
$_=",,.,,.,,,,,,,.,,,.,,,,,,,..,,.,,,,,,,,,,,.,,,,,.,,,";
s/\s//gs;tr/,./05/;my(@a,$o,$i)=split//;$_=<DATA>;tr/~`'"^/0-4/;map{$o
.=$a[$i]+$_;$i++}split//;@a=$o=~m!...!g;map{print chr}@a; __DATA__
`~^`~~``^`~`~`^``~`~``''~^'`~^``'``^```~^``'```'~`~

Re: Load Balancing, mod_proxy, rewrite problem

Posted by Tom Lancaster <tl...@redhat.com>.
On closer examination, I don't think this will solve your problem - this 
helps when you want to proxy something that's been included via mod_include.

Tom


On Tue, May 14, 2002 at 09:32:54AM -0700, Tom Lancaster wrote:
> I think I had a similar problem. It's a while since I tackled it, so I might
> be wrong. In any case, I was having problems doing proxy with a rewritemap.
> My reason for wanting to do this was so I could use the weighting feature of
> rewritemaps to do weighted load balancing between frontend and backend 
> apaches.
> 
> I mailed Engelschall, but I hear he gets so much mail about mod_rewrite that
> it takes him years to respond.
> 
> In any case, I have a patch to mod_rewrite that fixed the problem for me.
> The breakdown of the issue was that mod_rewrite wouldn't do a proxy on a
> subrequest.
> 
> Be warned: I think this patch causes problems with the automatic adding of 
> trailing /'s on URLs.
> 
> Tom
> 
> 
> 
> On Tue, May 14, 2002 at 12:19:44PM -0400, Perrin Harkins wrote:
> > mire wrote:
> > > I have code like this:
> > > 
> > >         RewriteEngine On
> > >  
> > >         RewriteLog "/var/site/rewrite.log"
> > >         RewriteMap    lb      prg:/tmp/lb
> > > 
> > >         RewriteRule  ^/trta$  http://${lb:prvi|drugi}  [proxy,last] 
> > > 
> > > and a perl script (a copy from mod_proxy manual) but it doesn't work, it seems
> > > like perl script is waiting indeffinetly for input.
> > 
> > Sorry, this is not a mod_perl problem.  You should try the general 
> > Apache user mailing lists, or see if there's a list or newsgroup for 
> > mod_rewrite.
> > 
> > - Perrin
> 
> -- 
> Tom Lancaster		Red Hat, Inc.
> toml@redhat.com		(510)-986-8770 x 354

> This patch is necessary to allow rewriterules to be applied to subrequests when
> they are meant to be proxied. We need this to allow mod_include to get /apps/include/pane.html from the app servers by proxy.
> 
> --- apache_1.3.19/src/modules/standard/mod_rewrite.c.proxy-subreq	Wed Jan 31 20:12:26 2001
> +++ apache_1.3.19/src/modules/standard/mod_rewrite.c	Wed May 23 16:39:47 2001
> @@ -1604,10 +1604,10 @@
>          /*
>           *  Ignore this rule on subrequests if we are explicitly
> -         *  asked to do so or this is a proxy-throughput or a
> +         *  asked to do so or if this is a
>           *  forced redirect rule.
>           */
>          if (r->main != NULL &&
>              (p->flags & RULEFLAG_IGNOREONSUBREQ ||
> -             p->flags & RULEFLAG_PROXY          ||
> +        /*   p->flags & RULEFLAG_PROXY          ||  */
>               p->flags & RULEFLAG_FORCEREDIRECT    )) {
>              continue;


-- 
Tom Lancaster		Red Hat, Inc.
toml@redhat.com		(510)-986-8770 x 354

Re: Load Balancing, mod_proxy, rewrite problem

Posted by Tom Lancaster <tl...@redhat.com>.
I think I had a similar problem. It's a while since I tackled it, so I might
be wrong. In any case, I was having problems doing proxy with a rewritemap.
My reason for wanting to do this was so I could use the weighting feature of
rewritemaps to do weighted load balancing between frontend and backend 
apaches.

I mailed Engelschall, but I hear he gets so much mail about mod_rewrite that
it takes him years to respond.

In any case, I have a patch to mod_rewrite that fixed the problem for me.
The breakdown of the issue was that mod_rewrite wouldn't do a proxy on a
subrequest.

Be warned: I think this patch causes problems with the automatic adding of 
trailing /'s on URLs.

Tom



On Tue, May 14, 2002 at 12:19:44PM -0400, Perrin Harkins wrote:
> mire wrote:
> > I have code like this:
> > 
> >         RewriteEngine On
> >  
> >         RewriteLog "/var/site/rewrite.log"
> >         RewriteMap    lb      prg:/tmp/lb
> > 
> >         RewriteRule  ^/trta$  http://${lb:prvi|drugi}  [proxy,last] 
> > 
> > and a perl script (a copy from mod_proxy manual) but it doesn't work, it seems
> > like perl script is waiting indeffinetly for input.
> 
> Sorry, this is not a mod_perl problem.  You should try the general 
> Apache user mailing lists, or see if there's a list or newsgroup for 
> mod_rewrite.
> 
> - Perrin

-- 
Tom Lancaster		Red Hat, Inc.
toml@redhat.com		(510)-986-8770 x 354

Re: Load Balancing, mod_proxy, rewrite problem

Posted by Perrin Harkins <pe...@elem.com>.
mire wrote:
> I have code like this:
> 
>         RewriteEngine On
>  
>         RewriteLog "/var/site/rewrite.log"
>         RewriteMap    lb      prg:/tmp/lb
> 
>         RewriteRule  ^/trta$  http://${lb:prvi|drugi}  [proxy,last] 
> 
> and a perl script (a copy from mod_proxy manual) but it doesn't work, it seems
> like perl script is waiting indeffinetly for input.

Sorry, this is not a mod_perl problem.  You should try the general 
Apache user mailing lists, or see if there's a list or newsgroup for 
mod_rewrite.

- Perrin