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:[EMAIL PROTECTED] 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



Reply via email to