Nginx x_forwarded_for get double ip address

1.4k views Asked by At

When i used nginx $http_x_forwarded_for to get user real_IP, but sometime, i found the realIP is double from access.log, like:"223.8.37.61, 123.151.77.70". why?

1

There are 1 answers

1
Richard Smith On

The X-Forwarded-For header contains a list of IP addresses. Use the realip module to parse the header to extract the client's IP address.

For example:

set_real_ip_from  192.168.1.1;
real_ip_header    X-Forwarded-For;

See this document for more.