Subrequest using Parent Request Body

agentzh agentzh at gmail.com
Mon May 10 07:09:39 MSD 2010


On Mon, May 10, 2010 at 8:30 AM, peterjanovsky <nginx-forum at nginx.us> wrote:
> i may be experiencing the same issue.  built a filter which sends a
> subrequest to a location different from the parent request.  in my scenario
> i've seen both the parent and subrequest called first (varnishlog), haven't
> been able to figure out why the order in which requests are called is not
> consistent.

Because non-blocking I/O takes action here (well, merely a guess,
because I haven't seen your code and config) :)

There's a consistent "active request" relay chain going on here
though, i.e., the pointer of r->connection->data. One should not take
certain actions when the current "active request" is not the one that
is being operated in most cases, or he will run into troubles :) Also,
be very careful with r->main->count, if one does not get it right,
mysterious issues like response truncating and request hanging are not
unusual at all :) (In those cases, --with-debug is your friend :))

There're a bunch of nginx modules that take advantage of subrequests,
like ngx_addition, ngx_ssi, ngx_eval, ngx_echo, ngx_auth_request (and
more are coming!)

Cheers,
-agentzh



More information about the nginx mailing list