You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sumit Shah <ss...@gce2000.com> on 2006/09/01 23:38:16 UTC

HTTP Proxy using MOD_PERL

Hello,

I am very new to MOD_PERL. I am trying to a create a proxy in Apache
using MOD_PERL. I have a perl script that takes an HTTP request
parameter as input and returns appropriate result. I am trying to:
--> get a handle to the HTTP request object, 
--> filter it based on static/dynamic content,
--> then invoke this perl script using HTTP request parameter,
--> Forward the request

I would appreciate if anyone could point me to the documentation or
suggest ways to achieve this.

Thanks
Sumit

Re: HTTP Proxy using MOD_PERL

Posted by Charles Bueche <ch...@bueche.ch>.
Hi,

I'm not sure what you mean by "processing", I assume it's some sort of
filtering of the HTTP data flow. What _I_ do is use mod_proxy in
reverse-proxy configuration :

browser --> reverseproxy --> backend-web-server

On the reverse-proxy, I use mod_proxy and mod_perl, plus sometimes
output filters to mangle the data coming back from the web server up to
the browser.

A detailed view of the involved modules :

- I configure mod_proxy either with ProxyPass or with "P" proxy-mode of
mod_rewrite in the most complicated situations. There is always the
associated ProxyPassReverse. The mod_proxy can be seen as the
"content-generation phase" in the request life cycle.

- When authentication/authorization is required, I use a module called
mod_auth_tkt. I then configure a mod_perl SSO module I wrote to pass the
authentication info (user and groups, auto-created BasicAuth, etc) to
the back-end by generating my own HTTP headers. This module is inserted
in the fixup phase in the request life cycle.

- When the backend-web-server host a non-proxy-aware application (eg the
brain-dead Microsoft OutlookWebAccess, or nGenius NetScout, or NetCool
WebTop), I filter the data flow using simple SetOutputFilter provided by
http://apache.webthing.com/mod_line_edit

If all this stuff sounds like Chinese, you will need to make you smart.
Buy some books and start hacking. Expect some headaches and don't fear
to look into source code to understand what going on.

Charles

Charles Bueche wrote:
> Hi,
> 
> chapter 7 of http://www.oreilly.com/catalog/wrapmod/ has something, but
> it is outdated.
> 
> If I understand your need correctly, you could use the normal mod_proxy
> module and filter your input and/or output using Apache 2 filters.
> 
> I us this to make the wildest things, including fixing non-proxy-aware
> applications in reverse-proxy configs. Check the numerous O'Reilly
> articles on filters.
> 
> Charles
> 
> Sumit Shah wrote:
>> Hello,
>>
>> I am very new to MOD_PERL. I am trying to a create a proxy in Apache
>> using MOD_PERL. I have a perl script that takes an HTTP request
>> parameter as input and returns appropriate result. I am trying to:
>> --> get a handle to the HTTP request object, 
>> --> filter it based on static/dynamic content,
>> --> then invoke this perl script using HTTP request parameter,
>> --> Forward the request
>>
>> I would appreciate if anyone could point me to the documentation or
>> suggest ways to achieve this.
>>
>> Thanks
>> Sumit
> 

-- 
Charles Bueche <ch...@bueche.ch>
sand, snow, wave, wind and net -surfer

Re: HTTP Proxy using MOD_PERL

Posted by Charles Bueche <ch...@bueche.ch>.
Hi,

chapter 7 of http://www.oreilly.com/catalog/wrapmod/ has something, but
it is outdated.

If I understand your need correctly, you could use the normal mod_proxy
module and filter your input and/or output using Apache 2 filters.

I us this to make the wildest things, including fixing non-proxy-aware
applications in reverse-proxy configs. Check the numerous O'Reilly
articles on filters.

Charles

Sumit Shah wrote:
> Hello,
> 
> I am very new to MOD_PERL. I am trying to a create a proxy in Apache
> using MOD_PERL. I have a perl script that takes an HTTP request
> parameter as input and returns appropriate result. I am trying to:
> --> get a handle to the HTTP request object, 
> --> filter it based on static/dynamic content,
> --> then invoke this perl script using HTTP request parameter,
> --> Forward the request
> 
> I would appreciate if anyone could point me to the documentation or
> suggest ways to achieve this.
> 
> Thanks
> Sumit

-- 
Charles Bueche <ch...@bueche.ch>
sand, snow, wave, wind and net -surfer