Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 52 lines (36 sloc) 1.448 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
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 utlities 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.