Re: custom proxy setup with mod_perl

Fred Moyer <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAHrynWDP87xyqTge1i9cEFVDF5LHbCBKYu4d6r-8+OJXCaKFyQ@mail.gmail.com>
On Fri, Nov 23, 2012 at 2:18 PM, André Warnier <[email protected]> wrote:
> Fred Moyer wrote:
>>
>> You might want to take a look at a mod_perl based proxy module I wrote
>> - https://metacpan.org/module/Apache2::Proxy
>>
>> It was used in conjunction with Perlbal and a couple other tricks, but
>> was pretty speedy given the crude nature of how I implemented it.
>
>
> No offense intended, Fred, but without much of a documentation, this is bit
> above my level.  I have trouble even understanding where it fits in.

None taken, you're quite right, this needs (more) documentation. It
was open sourced when still in rough form. I'll send a ping when I get
it cleaned up and 0.05 released. Anyway, here's the basic way I used
it. Torsten's solution is probably technically more adept, but I
couldn't do what I needed to using filtering, so I had to write this.

<Location />
    SetHandler          modperl
    PerlHeaderParserHandler Apache2::Const::OK
    PerlAccessHandler       Apache2::Const::OK
    PerlAuthenHandler       Apache2::Const::OK
    PerlAuthzHandler        Apache2::Const::OK
    PerlTypeHandler         Apache2::Const::OK
    PerlFixupHandler        Apache2::Const::OK
    PerlResponseHandler     My::Proxy->handler
</Location>

package My::Proxy;
use base 'Apache2::Proxy';

sub handler {
    my ($r, $class) = @_;

    # examine request to see if it needs to be modified

    # if not, pass to Apache2::Proxy
    return $class->SUPER::handler($r);

    # else fixup the request as needed.
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.