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

NameTypeDescription
fieldheader name | proxy_protocolChoose 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;
Nginx Reference