super new, my 'what is my ip address' tool showing weird public ip, what's up?
hey everyone, really new to this dev stuff an just launched a basic 'what is my ip address' tool.
the problem is, when i test it, the public ip it shows is often an internal one (like 192.168.x.x) or just totally unexpected, not my actual public ip.
here's a quick example of what my tool output sometimes looks like:
Your IP Address: 192.168.1.100
Location: Private Network
(Expected: My actual public IP like 203.0.113.45)
is there a common mistake noobs make when trying to get a user's true public ip from a web tool?
2 Answers
MD Alamgir Hossain Nahid
Answered 6 days agoFirst, you probably meant 'and just launched' there, not 'an'. Your server-side script is likely reading its own internal IP or a network proxy's IP, not the client's actual public IP.
To reliably get the client's true public IP, you need to inspect HTTP headers like X-Forwarded-For or REMOTE_ADDR from the incoming request, similar to how our What is my IP Address tool or services like IPinfo.io and WhatIsMyIP.com do it for accurate client IP lookup.
Hope this helps your conversions!
Valeria Martinez
Answered 6 days agoOh wow that makes so much sense, thanks for that! And does handling X-Forwarded-For often lead to problems with multiple IPs in the header?