Hello!
On Fri, Aug 8, 2014 at 1:45 AM, Aapo Talvensaari wrote:
>
> I think that the current API may lead to hard to debug bugs. Whenever you
> are setting (say cookie, or any other header multiple times), you need to
> use code something like this:
>
This one is different from the original use case that removes a header
entry fulfilling certain conditions while keeping other entries with
the same header name.
For your use case, we could add a new API function,
ngx.resp.add_header(), that blindly adds a new header entry regardless
existing header entries with the same name (just like the standard
"add_header" directive). Such that, you can do
"ngx.header['Set-Cookie'] = 'blah blah blah'". However, the
ngx.header.HEADER API is a low-level nginx-side operation that
removing things is always expensive. So it's better to buffer and
filter cookies, for example, on the Lua land, and inject everything
into the nginx data structures via the ngx.header API in the end.
Regards,
-agentzh