Hello, I'm trying to write a mod_perl based input filter that will change the cookies in a request and then pass the request to mod_proxy. I think i'm pretty close to figuring this out, but its not working. At this point I can confirm my filter is running and modproxy is running, but the cookies aren't changing. Here's my filter code:
TestFilter.pm ------------------------------------------------------------------------------ package MyApache2::TestFilter; use Apache2::Filter; use Apache2::ServerUtil; use APR::Table; use Apache2::RequestRec; use base qw(Apache2::Filter); use Apache2::Const -compile => qw(OK :log); use APR::Const -compile => qw(:error SUCCESS); sub input : FilterRequestHandler { my($filter, $bb, $mode, $block, $readbytes) = @_; #... my $s = Apache2::ServerUtil->server; $s->log_error("server: log_error"); $ENV{HTTP_COOKIE} = "somecookie=somevalue;"; my $r = $filter->r; $s->log_error("r object : $r"); my $headers = $r->headers_in; $s->log_error("headers : $headers"); my $cookies = $headers->{Cookie}; $s->log_error("cookies object : $cookies"); $headers->{Cookie} = "mycookie=pleasework;"; $headers = $r->headers_in; $s->log_error("headers2 : $headers"); $cookies = $headers->{Cookie}; $s->log_error("cookies object2 : $cookies"); my $rv = $filter->next->get_brigade($bb, $mode, $block, $readbytes); return $rv unless $rv == APR::Const::SUCCESS; return Apache2::Const::OK; } sub output : FilterRequestHandler { my($filter, $bb) = @_; #... } 1; ------------------------------------------------------------------------------------------------------------------ Here's the log output: ------------------------------------------------------------------------------------------------------------------ [Sat Jan 06 21:45:18 2007] [notice] Apache/2.2.2 (Fedora) configured -- resuming normal operations [Sat Jan 06 21:45:25 2007] [error] server: log_error [Sat Jan 06 21:45:25 2007] [error] r object : Apache2::RequestRec=SCALAR(0x92f0d40) [Sat Jan 06 21:45:25 2007] [error] headers : APR::Table=HASH(0x93769a0) [Sat Jan 06 21:45:25 2007] [error] cookies object : ObPERM=%23userservcenterEmployeesuserservcenterCustomList%3D2%3A8%23; mycookie=myvalue; JSESSIONID=692416A2F98FD34638A79B2277E72E44; [Sat Jan 06 21:45:25 2007] [error] headers2 : APR::Table=HASH(0x930df98) [Sat Jan 06 21:45:25 2007] [error] cookies object2 : mycookie=pleasework; ------------------------------------------------------------------------------------------------------------------ Here is my configuration: ------------------------------------------------------------------------------------------------------------------ PerlModule MyApache2::TestFilter <Location /rocks> SetHandler perl-script PerlInputFilterHandler -MyApache2::TestFilter::input ProxyPass http://localhost:8080/ </Location> ------------------------------------------------------------------------------------------------------------------ When I reach the proxied resource, all of the cookies are being send, not just the "mycookie" cookie. Am what I am trying possible? Thanks Marc