Hello!
On Mon, Feb 8, 2016 at 12:12 PM, Robert Paprocki
<rpap...@fearnothingproductions.net> wrote:
> I'm a little unclear on the context in which ngx.req.discard_body should be
> called.
>
Only when you want to throw away useless request body.
> - If ngx.req.discard_body is called in a handler before a proxy_pass
> directive, does this mean the upstream will not be sent the request body?
Aye. Discarding means throwing away request body data. And later phase
handlers like ngx_proxy cannot read a body that is already (being)
thrown away.
> - Similarly, if one does not call ngx.req.ready_body before proxy_pass, does
> that mean the upstream would not be sent the request body (I would assume
> this is not the case, but just looking for a better understanding)?
Nope. ngx_proxy always tries to read the request body itself.
> - The docs mentioned read_body and discard_body should be called to avoid
> breaking HTTP 1.1 keepalive and pipelining. Does this mean they should be
> called in -every- situation in which a Connection: keep-alive header is
> sent?
>
This part was for working around an old bug in ngx_lua which is
obsolete now since it's already fixed in recent versions. I've updated
the docs already.
Regards,
-agentzh