<!-- review: finished -->

<a id="http-addition"></a>

# Addition

The module is a filter that adds text before and after a response.

When [building from the source code](https://en.angie.software//angie/docs/installation/sourcebuild.md#sourcebuild),
this module isn't built by default;
it should be enabled with the
`‑‑with‑http_addition_module`
[build option](https://en.angie.software//angie/docs/installation/sourcebuild.md#configure).

In packages and images from [our repos](https://en.angie.software//angie/docs/installation/index.md#install-packages),
the module is included in the build.

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

## Configuration Example

```nginx
location / {
    add_before_body /before_action;
    add_after_body  /after_action;
}
```

<a id="directives-5"></a>

## Directives

<a id="index-0"></a>

<a id="add-before-body"></a>

### add_before_body

| [Syntax](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)   | `add_before_body` uri;   |
|------------------------------------------------------------------------------------------|--------------------------|
| Default                                                                                  | —                        |
| [Context](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)  | http, server, location   |

Adds the text returned as a result of processing a given subrequest before the response body. An empty string (`""`) as a parameter cancels addition inherited from the previous configuration level.

<a id="index-1"></a>

<a id="add-after-body"></a>

### add_after_body

| [Syntax](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)   | `add_after_body` uri;   |
|------------------------------------------------------------------------------------------|-------------------------|
| Default                                                                                  | —                       |
| [Context](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)  | http, server, location  |

Adds the text returned as a result of processing a given subrequest after the response body. An empty string (`""`) as a parameter cancels addition inherited from the previous configuration level.

<a id="index-2"></a>

<a id="addition-types"></a>

### addition_types

| [Syntax](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)   | `addition_types` mime-type ...;   |
|------------------------------------------------------------------------------------------|-----------------------------------|
| Default                                                                                  | `addition_types text/html;`       |
| [Context](https://en.angie.software//angie/docs/configuration/configfile.md#configfile)  | http, server, location            |

Allows adding text in responses with the specified MIME types, in addition to "text/html". The special value "\*" matches any MIME type.
