Subrequests and output filters

Maxime Henrion mhenrion at
Fri Aug 7 18:22:25 UTC 2015

Thanks, I see I should be using r->upstream->buffer now. However this callback never seems to be called into for me... I have some heavy log messages there that don't show. I can tell that the response was read however, as if I send random garbage nginx complains about the response not having the proper HTTP headers.

Any ideas?

From: nginx-devel [nginx-devel-bounces at] on behalf of Maxim Dounin [mdounin at]
Sent: Friday, August 07, 2015 8:00 PM
To: nginx-devel at
Subject: Re: Subrequests and output filters


On Fri, Aug 07, 2015 at 11:33:06AM +0000, Maxime Henrion wrote:

> Thanks for the answer.
> I have tried using the NGX_HTTP_SUBREQUEST_IN_MEMORY flag and a
> post subrequest callback; in fact the code I copy-pasted uses
> those. However, I don't see how to get at the response's body
> from this callback. Looking at the SSI module code, the
> ngx_http_ssi_stub_output() post subrequest callback does some
> consistency checks, sets the headers if they haven't been set
> already, and then just calls into ngx_http_output_filter() with
> a buffer chain that was actually passed to it through the "data"
> field of the post subrequest handler structure.
> I'm obviously missing things here, but I don't understand how to
> get at that response's body still.

Function to look for is ngx_http_ssi_set_variable().

Maxim Dounin

nginx-devel mailing list
nginx-devel at

More information about the nginx-devel mailing list