The "headers_more" module: Set and clear output headers...more than "add"!

agentzh agentzh at
Wed Nov 18 10:48:58 MSK 2009

On Wed, Nov 18, 2009 at 10:18 AM, agentzh <agentzh at> wrote:
> But another TODO comes into my mind: adding support for input headers!
> Stay tuned :)

Okay, the input header support has finally landed in v0.05 after a few
hours' big refactoring and hacking. Here's some funny examples:

     location /foo {
           set $my_host 'my dog';
           more_set_input_headers 'Host: $my_host';
           more_set_input_headers -t 'text/plain' 'X-Foo: bah';

           # now $host and $http_host have their new values...

The "input header filter" runs in the access phase. I'm not sure if
it's completely right but this phase lets me pass all the related
tests in


while other phases break things horribly :)

Theoretically it should also work with subrequests. But unfortunately
the ngx_http_subrequest function in the core seems to be buggy
regarding r->headers_in handling IIRC. So be careful with that :)

I'll work on the wiki page for this module soon.


More information about the nginx mailing list