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

NameTypeDescription
nameHTTP field nameChoose a permitted trailer field.
valuestring or variable expressionSet a harmless final metadata value.
alwaysliteral alwaysRemove the response-status restriction.

Working Example

Example Snippetnginx
add_trailer X-Lab-Complete yes always;
Nginx Reference