Accessing backend response using nginx' Perl module

Peter A Leonov gojpeg at gmail.com
Mon Oct 5 09:56:54 MSD 2009


On 05.10.2009, at 1:07, Srebrenko Sehic <ssehic at gmail.com> wrote:

> Hi,
>
> I have a simple reverse proxy setup where a Perl module does some
> processing on the request and then forwards the request via the proxy
> module using an internal_redirect method. I also need to adjust the
> response from the backend. This includes the headers and body.
>
> I looked at the nginx.xs and ngx_http_perl_module.c but could not see
> how it could be done (I'm still pretty new to nginx so bear with me).
> I guess an output filter hook needs to written and the API exposed to
> the Perl module in some way.
Yep. It'll be usefull to add a new simple configuration directive like  
perl_filters on; so you can ask nginx not to involve perl interpreter  
in most requests processing (such as static file sending).

>
> Can someone point me in the right direction?
Reading the source of any simple filter module will be good.  
ngx_http_addition_module is the basic example for responce processing.

I'v got some success on writing filters with javascript built in  
nginx. But can't say it's stable for production ;)

>
> Thanks,
> Srebrenko

—
Peter Leonov




More information about the nginx mailing list