DEV Community

baris
baris

Posted on

Answer: Why does ServerVariable[“REMOTE_ADDR”] returns the server IP?

My guess is that there is a proxy in the middle. Use HTTP_X_FORWARDED_FOR first, and if that's null, then use REMOTE_ADDR

From the MSDN article:

Although retrieving just the REMOTE_ADDR server variable should be enough, I found resources online that suggested that code like this should also check the…

ServerVariables for IP address

Top comments (0)