<!-- review: finished -->

<a id="external-headers-more"></a>

# Headers-More

The headers-more module allows you to add, set, or remove any outgoing or incoming headers.

<a id="installation-12"></a>

## Installation

To [install](https://en.angie.software//angie/docs/installation/index.md#install-packages) the module, use one of the following packages:

- Angie: `angie-module-headers-more`
- Angie PRO: `angie-pro-module-headers-more`

<a id="loading-the-module-12"></a>

## Loading the Module

To use the module, it must be loaded in the `main{}` context:

```nginx
load_module modules/ngx_http_headers_more_filter_module.so;
```

In the configuration example below, directives from the echo module are also used along with the module's own directives.
Loading the echo module:

```nginx
load_module modules/ngx_http_echo_module.so;
```

<a id="configuration-example-88"></a>

## Configuration Example

```nginx
http {
    server {
        listen 80;

        root  /usr/share/angie/html;
        index index.html index.htm;

        location /clear {
            more_clear_headers 'Content-Type';
            proxy_pass http://127.0.0.1:8081;
        }

        location /settype {
            more_set_headers 'Content-Type: text/plain';
            proxy_pass http://127.0.0.1:8081;
        }

        location /changetype {
            more_set_headers -t 'text/plain text/css' 'Content-Type: text/newtype';
            proxy_pass http://127.0.0.1:8081;
        }

        location /newheader {
            more_set_headers -t 'text/plain text/css' 'New-Header: foo';
            proxy_pass http://127.0.0.1:8081;
        }

        location /404 {
            more_set_headers -s '400 404 500 503' 'Upstream-Status: $upstream_status';
            proxy_pass http://127.0.0.1:8081;
        }

        location /input {
            set $my_host 'my.host';
            more_set_input_headers 'Host: $my_host';
            more_set_input_headers -t 'text/plain' 'X-Foo: bar';

            echo "Host: $host";
            echo "X-foo: $http_x_foo";
        }
    }

    server {
        listen 8081;
        default_type text/css;

        location / {
            return 200 "OK\n";
        }

        location /404 {
            return 404 "Done\n";
        }
    }
}
```

<a id="additional-information-13"></a>

## Additional Information

Detailed documentation and source code are available at:
[https://github.com/openresty/headers-more-nginx-module/](https://github.com/openresty/headers-more-nginx-module/)
