[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: mp2: PerlTransHandler/proxying with question mark in URL
From:       Stas Bekman <stas () stason ! org>
Date:       2004-10-31 0:21:43
Message-ID: 41843017.2080507 () stason ! org
[Download RAW message or body]

Eric Lenio wrote:
> In my apache config file I'm using a PerlTransHandler call to do URL rewriting.
> Basically I want to map all URL's beginning with
> 
>   http://testhost.lenio.net
> 
> to internally to go to:
> 
>   http://localhost:8080
> 
> This works perfectly except when I introduce a URL with a question
> mark like this:
> 
>   http://testhost.lenio.net?argument1=some_value
> 
> The proxy seems to try to escape the question mark to be %3F, but that's where
> I'm getting lost.  Thoughts?  Here's the actual PerlTransHandler:

shouldn't there be a slash after the domain name? 
http://testhost.lenio.net/?argument1=some_value

I wonder if that's a valid URL at all:
http://testhost.lenio.net?argument1=some_value

> use Apache::RequestRec ();
> use Apache::Const -compile => qw(DECLINED :common);
> sub handler {
>   my $r = shift;
>   my $hostname = $r->hostname;
>   my $real_url = $r->unparsed_uri;
>   if ($hostname =~ m{^testhost\.}i) {
>     $r->proxyreq(1);
>     $r->uri($real_url);
>     $r->filename(sprintf "proxy:http://localhost:8080%s",$real_url);
>     $r->handler('proxy-server');
>     return Apache::OK;
>   }
>   return Apache::DECLINED;
> }
> 1;

Why don't you just rewrite the URLs with ProxyPass?
http://perl.apache.org/docs/1.0/guide/scenario.html#toc_Concepts_and_Configuration_Directives

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic