HTTP directives
real_ip_header directive (HTTP)
Contexts: http, server, location. Default: X-Real-IP. Requires HTTP Real IP module; PROXY protocol needs compatible listener configuration.
Formal Syntax & Structure
nginx syntaxnginx
real_ip_header field | X-Real-IP | X-Forwarded-For | proxy_protocol;Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| field | header name | proxy_protocol | Choose replacement source; PROXY protocol also requires a matching listener setting. Do not trust arbitrary direct clients. |
Working Example
Example Snippetnginx
real_ip_header X-Forwarded-For;