Removing response headers

Yichun Zhang (agentzh) agentzh at gmail.com
Wed Jul 3 19:34:02 UTC 2013


Hello!

On Tue, Jul 2, 2013 at 7:35 AM, Jeff Kaufman <jefftk at google.com> wrote:
> In a header filter, to remove a filter that's already been set, I see
> two options:
>
> 1. set the header's hash to 0

For *response* headers, this approach is recommended.

> 2. actually delete the header from r->headers_out
>
> The second is much more complex and requires allocating memory (see
> ngx_http_headers_more_rm_header_helper in
> https://github.com/agentzh/headers-more-nginx-module/blob/master/src/ngx_http_headers_more_util.c#L294)
> so I'd rather use the first, but is there a reason to prefer the
> second?
>

The ngx_http_headers_more_rm_header_helper function is only used for
removing *request* headers because setting ->hash to 0 does not work
for request headers.

Best regards,
-agentzh



More information about the nginx-devel mailing list