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

agentzh agentzh at
Tue Nov 17 13:00:59 MSK 2009

Hi, folks!

After two days' work, I've now got the "headers_more" module passing
the its own test suite. This is an enhanced version of the standard
"headers" module because it provides more utilities like resetting or
clearing output headers. Builtin headers, like "Content-Type",
"Content-Length", and "Server",  are also manipulatable ;)

It also allows you to specify an optional HTTP status code criteria
using the -s option and an optional content type criteria using the -t

Here's some random use cases:

    more_set_headers 'Server: my-server';

    location /foo {
        more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo';
        more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo';
        more_set_headers -s '400 404 500 503' 'Foo: Bar';
        more_clear_headers 'Transfer-Encoding' 'Content-Type';

    location /type {
        more_set_headers 'Content-Type: text/plain';

One important TODO is to allow variables within the new headers'
values. That's where "headers_more" is "less" than the standard
"headers" module :P

The Git source repository is here:

And you're recommended to use the tarballs for the tagged releases:

Don't hesitate to report any issues that you find ;)


More information about the nginx mailing list