I understand that x-http-forwarded should normally contain the IP address of the originating client if they are behind a proxy server. I recently implemented this in my code, but the code didn't work because x-http-forwarded returned more than one IP address and many were local IP addresses, not the proper internet connection IP address. How can I work out which is the correct IP address?
The reason I need this working is because we have developed a webstats system and we currently use ServerVariables["REMOTE_ADDR"] for IP addresses, but realise that some clients might be behind a proxy which would then give us the proxy server IP address not the originating IP address.
Thank you for using JustAnswer.com my name is XXXXX XXXXX X am going to assist you today
In your code remove all results that return
127. 0.0.1 10. 0.0.0 – 10.255.255.255 172. 16.0.0 – 172. 31.255.255 192.168.0.0 – 192.168.255.255
The local Ip ranges
Which would be
(^127\.0\.0\.1)| (^10\.)| (^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)| (^192\.168\.)
I'll give that a try thank you!
You are very welcome