You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Johnny Shz <jo...@gmail.com> on 2005/05/23 00:28:26 UTC
Help with PerlTransHandler
Hi, I'm trying to write my own translation handler. The problem is that I'd like to map something like:
/foo.html to /bar/servlet/test
where /bar/ is supposed to be handled by mod_jk with something like:
<Location "/bar">
JkUriSet worker ajp13:localhost:8009
</Location>
When I tried to use mod_rewrite, the mapping took effect, but then apache tried to find the file: "/bar/servlet/test"
rather than applying the <Location/> to send to mod_jk.
I thought a mod_perl's PerlTransHandler will solve this problem, with a simple:
package Urlmap;
use strict;
use Apache2::Const -compile => qw(DECLINED);
use Apache2::RequestRec;
sub handler{
my $r = shift;
my $uri = $r->uri;
my $target = "";
if($uri =~ m|^/foo.html|i){
$r->uri("/bar/servlet/test");
}
return Apache2::Const::DECLINED;
}
But it is giving me the same error, it returns a 404 file not found for "/bar/servlet/test".
So how can I change the URL, and still apply the <Location/> directive afterwards?
Thanks.
Z.
Re: Help with PerlTransHandler
Posted by Torsten Foertsch <to...@gmx.net>.
On Monday 23 May 2005 00:28, Johnny Shz wrote:
> <Location "/bar">
> JkUriSet worker ajp13:localhost:8009
> </Location>
I think, you need a SetHandler inside the <Location>. Then mod_rewrite should
work as well.
Torsten