Subrequest using Parent Request Body

Matthieu Tourne matthieu.tourne at
Sat May 8 02:38:54 MSD 2010


I'm trying to send a POST Subrequest using the same request_body as the
Parent Request.
The subrequest is sent first, and once it has been finalized the parent
request goes through.
(this is inspired on Maxim's ngx_http_auth_request_module)

It works almost fine, but if I try to make this subrequest to a location
containing a proxy_pass, I get some weird behavior. (The connection takes
forever to terminate).

My guess is that the request_body gets read by the upstream, and discarded.
When the parent request goes through, that data is not available anymore.
If I create a dummy request_body for the subrequest with temporary buffers,
it seems to work fine.

I think I might be able to get around this by reading first the original
request_body using ngx_http_read_client_request_body(),
and then copying the content of r->request_body to temporary buffers in my

But I'm not sure that would be the best way to solve this problem.

Any ideas ?

Thank you,


Matthieu Tourne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list