Hi all,
I'm setting up an Apache-based reverse proxy (using regular the mod_proxy),
and I'd like to chain the incoming HTML flow into a mod_perl filter handler,
so that I could fix some text (mainly URLs, cos the site is built using
absolute URLs that make users send their requests w/o getting thru the reverse
proxy).
So far, I was not able to set up the server. Here's an excerpt of my httpd.conf
file (Apache and mod_perl are 2.0 btw):
<IfModule mod_proxy.c>
ProxyRequests Off
RewriteEngine on
ProxyPass /google/ http://www.google.fr/
ProxyPassReverse /google/ http://www.google.fr/
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</IfModule>
PerlModule Apache2
PerlModule Apache::Filter
<Location /google>
SetHandler modperl
PerlSetVar Filter On
PerlOutputFilterHandler FilterGoogle
</Location>
The FilterGoogle perl details are :
package FilterGoogle;
use strict;
use warnings;
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Const -compile => qw(OK);
sub handler {
my $r = shift;
$r->content_type('text/plain');
while ($f->read(my $buffer, BUFF_LEN)) {
for (split "\n", $buffer) {
s/something/something_else/g;
$f->print($_);
$f->print("\n");
}
Apache::OK;
}
1;
__END__
It seems that when one handler gets called, the second one does not get into
play. How can I stack the handlers in the correct order ? What pre-requisite
must the perl handler comply with ?
Tx all for your help !
Cheers,
Bruno.
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html