Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Set, add, and clear arbitrary output headers
Perl C

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
test
util
.gitignore
README
config

README

This module allows you to add, set, or clear any output header
that you specify.

This is an enhanced version of the standard
"headers" module because it provides more utilities like
resetting or clearing "builtin headers" like "Content-Type",
"Content-Length", and "Server".

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 option.

Usage

    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';
    }

Installation

Grab the nginx source code from nginx.net, for example, the
version 0.8.24 (see Nginx Compatibility), and then build the
source with this module:

    $ wget 'http://sysoev.ru/nginx/nginx-0.8.24.tar.gz'
    $ tar -xzvf nginx-0.8.24.tar.gz
    $ cd nginx-0.8.24/

    # Here we assume you would install you nginx under /opt/nginx/.
    $ ./configure --prefix=/opt/nginx \
        --add-module=/path/to/headers-more-nginx-module

    $ make -j2
    $ make install

Nginx Compatibility

     0.8.x (last tested version is 0.8.24)
     0.7.x >= 0.7.21 (last tested version is 0.7.63)

-agentzh

Something went wrong with that request. Please try again.