How do I get the correct IP from HTTP_X_FORWARDED_FOR if it contains multiple IP Addresses?

According to this, the format of X-Forwarded-For HTTP header is:

X-Forwarded-For: client1, proxy1, proxy2, ...

So the IP address of the client that you want should be the first one in the list

Leave a Comment