HTTP directives
add_trailer directive (HTTP)
Append a field after the response body. Default: no added field. Allowed in http, server, location and if in location. Ordinary status eligibility: 200, 201, 206, 301, 302, 303, 307 and 308. A protocol/client that cannot carry trailers may omit them; always is not a delivery guarantee. Local lists replace inherited lists unless inheritance is changed. Do not put authorization or required metadata in trailers. Version: 1.13.2. HTTP headers module; modern inheritance control since 1.29.3. Example: partial location configuration for a disposable synthetic lab; not a complete deployment.
Formal Syntax & Structure
nginx syntaxnginx
add_trailer name value [always];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | HTTP field name | Choose a permitted trailer field. |
| value | string or variable expression | Set a harmless final metadata value. |
| always | literal always | Remove the response-status restriction. |
Working Example
Example Snippetnginx
add_trailer X-Lab-Complete yes always;