Nginx Real Ip

I encountered an issue with nginx and real ip values.

Ngninx real ip was setup but the ip address in logs were still pointing to the forwarding proxy. What happened?

I incorrectly set the real ip address value. It is supposed to be the ip address of the machine forwarding the tracking to nginx, not the ip address of the machine running nginx.

If nginx will receive traffic through more than 1 forwarder, define all forwarders with seperate set_real_ip_from lines (CIDR values may be used)

set_real_ip_from ip.of.proxy;
real_ip_header X-Forwarded-For;
real_ip_recursive on;

real_ip_header X-Forwarded-For; tells nginx to pull the ip address from the X-Forwarded-For HTTP Header line. Recursive will keep replacing the ip address until it no longer matches the value defined in set_real_ip_from.