I have my Application written in JSP and Servlet page. Whenever I try to track the user’s IP address it returns the Global IP Address of the machine (proxy server address), and not the Local area network IP Address of that machine. So, how to get the LAN IP Address of the user’s machine. Please Guide me get out of this issue…
Share
By necessity, your web server will only see the IP address of the machine that sent the request to you. If a user is behind a proxy server, that will be the proxy server making the request on behalf of the user (hence “proxy”). There’s no way for you to trace the origin of the request any further back, since it might come from anywhere. Only the proxy server will know, and unless it tells you, you won’t know.
The proxy may send an extra HTTP header like
X-Forwarded-For, in which case it tells you whose behalf it’s acting on. That IP address in turn may also be a proxy though, you can’t know. Also, this information is unverifiable and can be faked, so you should not rely on it anyway. The only verifiable IP address you get is the one your web server received the request from and will send the response to.If your machine was inside the LAN, you a) wouldn’t have this problem to begin with and b) if you did, you may be able to query something by machine name, for example. That would heavily depend on the network infrastructure though and is not generalizable.