Any way to reset r->request_body to avoid conflicts between modules?

ptcell nginx-forum at forum.nginx.org
Sun Sep 22 23:01:16 UTC 2019


I have a preaccess filter in my module that loads in the request_body with
`ngx_http_read_client_request_body` (it basically scans the buffer for
security violations, no modifications).  I don't discard the buffer and this
module works fine when proxying POST requests or multiform data to a
downstream reverse proxy.

If I try using a lua module that attempts to read the request body, too
(like `resty.upload`), the module complains that request->request_body
already exists and it cannot proceed.

Is there any way to reset request->request_body?  Just for a laugh I tried
setting it to 0 and of course that doesn't work.  Barring that is there a
way my module could read the request_body without causing a state change to
the request struct?

Thanks

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285672,285672#msg-285672



More information about the nginx mailing list