How to unset header in nginx module

Tsukasa Hamano hamano at
Sat Mar 17 08:34:08 UTC 2012

Hi Maxim,

Thank you for your advice.

At Fri, 16 Mar 2012 21:32:23 +0400,
Maxim Dounin wrote:
> > Should I reconstruct list of headers_in.headers?
> > Or, should I modify http main module that to avoid sending null header?
> > Or, Is there any better(faster) way?
> You shouldn't touch r->headers_in at all.  It represents headers
> got from client, and it's incorrect to change them.
> Instead, to restrict headers passed to backends you should use
> functionality provided by relevant backend modules, e.g. with
> proxy_pass use
>     proxy_set_header X-Some-Header "";

I want to modify and unset header based on client request. Apache can
do it. Is there a plan to make something like apr_table_unset()?

I found the following code:

I think I have no choise other than this code. but It looks
inefficient and slow.
Perhaps we can give meaning to key.len = 0 is unset flag, because
empty header name is not permitted by RFC.

Thanks for your comment.

Open Source Solution Technology Corporation
Tsukasa Hamano <hamano at>
fingerprint = 2285 2111 6D34 3816 3C2E  A5B9 16BE D101 6069 BE55
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP Digital Signature
URL: <>

More information about the nginx mailing list