Chapter 7
[ 169 ]
The addition module
The addition module works as a filter to add text before and/or after a response.
It is not compiled by default, so if you want to make use of this feature, you must
enable it at configure time by adding --with-http_addition_module.
This filter works by referencing a subrequest, which is then either appended to a
request, or placed at the beginning of one:
server {
root /home/www;
location / {
add_before_body /header;
add_after_body /footer;
}
location /header {
proxy_pass http://127.0.0.1:8080/header;
}
location /footer {
proxy_pass http://127.0.0.1:8080/footer;
}
}
The addition module directives are summarized in the following table:
Table: HTTP addition module directives
Directive Explanation
add_before_body Adds the result of processing a subrequest
before the response body.
add_after_body Adds the result of processing a subrequest
after the response body.
addition_types Lists the MIME types of a response in
addition to text/html, in which an
addition will be made. It may be * to
enable all MIME types.