If you want to use these modules, you must specify the relevant compilation parameters at compile time.
 
This module can add other location before or after the current location.
It executes as an output filter, and the primary and child requests contained in other location are not fully buffered and are still passed to the client as a stream, because the length of the final answer body is unknown at the time the HTTP header is passed, and the HTTP chunked encoding is always used here.
 
Installation
 
This module is not compiled by default, and if you want to use it, you need to specify the following parameters at compile time:
./configure--with-http_addition_module
Sample configuration:
Location/{add_before_body/before_action; add_after_body/after_action;
Some restrictions
 
In version 0.8.17 If the current location requests a child request of its own, the included location will not be added. such as the following configuration:
Location/foo {Add_before_body/bar} location/bar {Add_before_body/baz;}
The request to connect to/foo does not add the/baz corresponding location to the field.
Also note that you can only use strings when defining the location you want to include, but you cannot use variables, so the following configuration:
Location/{set $before _action/before_action; Add_before_body $before _action;}
does not work (although it can be passed when the test configuration file is correct)
 
Instructions
 
Add_before_body
 
Syntax: Add_before_body URI
Default value: No
Working with fields: HTTP, server, location
Adds a URI to the front of the answer body, sending a child request for one of the processing results.
 
Add_after_body
 
Syntax: Add_after_body URI
Default value: No
Working with fields: HTTP, server, location
Adds a URI to the back of the answer body, sending a child request for one of the processing results.
 
Addition_types
 
Syntax: Addition_types mime-type [Mime-type ...]
Default value: HTML
Working with fields: HTTP, server, location
Directive (0.7.9) allows additional MIME types (default "HTML") to be processed by the location. (This instruction was spelled "Addtion_types" in the source code before 0.8.17, but was fixed after version 0.8.17). )