I'm having a problem whereby I can't access POST CGI variables when using
an output filter (PerlOutputFilterHandler) alongside mod_proxy.
Parameters on the URL (GET) work just fine, its just the POST variables
that are missing.

My setup is that I'm using a mod_proxy reverse proxy to fetch some remote
content, then doing some analysis on the content using an output filter.

I suspect this has something to do with mod_proxy consuming the request data -
i.e., once the data of the HTTP request is read, its gone....
(http://httpd.apache.org/apreq/Apache-Request.html#instance).  Either way,
I need some way to be able to retrieve the POST parameters in the output
filter.

If I install the following sample OUTPUT filter (see example httpd.conf below),
the HTTP content itself is proxied ok, but the APR table scan ($CgiArgsRef->do)
doesn't find any of the POST'ed variables.

sub handler     {               # (filter)
        my $f = shift;
        my $r = $f->r;

        if ( ! $r->notes('not_first_bucket') ) {
                $r->notes->set('not_first_bucket' => 1);

                my $ApReq = Apache::Request->new($r);
                my $CgiArgsRef = $ApReq->param;

                # log CGI variables for debug...
                $CgiArgsRef->do( sub {
                        $r->log_error("CGI parameter: '" . $_[0] . "' = '" . $_[1] . 
"'");
                        return 1;
                });
        )

        return Apache::DECLINED;
}

And if I install this as an INPUT filter, I *do* actually get the POST data logged,
but then I wind up with a proxy error 502 -- something gets munged in the request and
it doesn't get to the back end server correctly.


The platform:

        Apache 2.0.49
        mod_perl-1.99_14
        libapreq2-2.03-dev
        perl v5.8.2
        Linux kernel 2.4.21

...and a snippet of my httpd.conf:

        ProxyRequests Off
        ProxyPass / http://remotesite
        ProxyPassReverse / http://remotesite

        PerlOutputFilterHandler +MyFilter
        # PerlInputFilterHandler +MyFilter


TIA for any help,

Eric





-- 
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