How to merge subrequest header.

agentzh agentzh at gmail.com
Thu Nov 25 14:22:53 MSK 2010


On Thu, Nov 25, 2010 at 6:36 PM, Roast <zhang.libing at gmail.com> wrote:
> It seems post_subrequest callback function can't change the parent's
> header,because the parent's header filter has been process finished before
> the function call, and the output buf has created.
>

The key point is that not to send out the parent headers when you need
to change it later (according to its subrequests or other things).

> And I have fixed this problem, at the header filter function. Just like
> following steps,maybe that's not a good way, agentzh pls give me some more
> advanced suggestion.
>
>> static ngx_int_t
>> ngx_http_social_header_filter(ngx_http_request_t *r)
>> {
>>     ...... //some other works
>>

You can surely buffer the parent requests' headers and any outputs
before your subrequest actually finishes in your output filter
functions ;)

Cheers,
-agentzh



More information about the nginx mailing list