HTTP directives
add_header directive (HTTP)
In http, server, location or if in location. No default field. Without always, applies to 200, 201, 204, 206, 301, 302, 303, 304, 307 and 308 on modern releases. always since 1.7.5. Under default inheritance, a child list replaces the parent list when defined; add_header_inherit is available since 1.29.3.
Formal Syntax & Structure
nginx syntaxnginx
add_header name value [always];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | field name | Response field name. |
| value | string | Field value, optionally containing variables. |
| always | keyword | Include field regardless of response code. |
Working Example
Example Snippetnginx
add_header X-Lab-Chapter 6 always;