Addition#

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

When building from the source code, this module isn't built by default; it should be enabled with the ‑‑with‑http_addition_module build option.

In packages and images from our repos, the module is included in the build.

Configuration Example#

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

Directives#

add_before_body#

Syntax

add_before_body uri;

Default

Context

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.

add_after_body#

Syntax

add_after_body uri;

Default

Context

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.

addition_types#

Syntax

addition_types mime-type ...;

Default

addition_types text/html;

Context

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.