Manipulating the body of a PUT/POST

Maxim Dounin mdounin at mdounin.ru
Fri Feb 3 10:04:51 UTC 2012


Hello!

On Fri, Feb 03, 2012 at 09:50:54AM +0100, Adam Hasselbalch Hansen wrote:

> Hi there,
> 
> I am wondering if there is a way to manipulate the contents of a
> PUT/POST (the request body) in a similar way that filters can
> manipulate the body of a GET?
> 
> Would it e.g. be feasible (or even possible) to do a
> ngx_http_read_client_request_body somewhere, mess about with the
> body, and then somehow (how?) shove it back into the request, before
> passing it on to whatever handles the actual writing (dav) or
> POST-processing (php, whatever) or even upstream to a proxy backend?
> 
> Any thoughts appeciated!

Currently there is no easy way.  Some modules (e.g. Valery 
Kholodkov's upload module) currently do this by reading request 
body by their own code.

I'm working on prototyping input body filtering, it's expected to 
appear somewhere in 1.2.x.  It will allow manipulation of request 
body, as well as other tasks like content inspection and so on.

Maxim Dounin



More information about the nginx-devel mailing list