DEV Community


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

boyukbas profile image baris ・1 min read

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

Discussion (0)

Editor guide