Hi Folks,
We have a requirement to capture the IP address of the end user machine who is browsing the web site.
The method
getRemoteAddr() on the Request interface gives the IP address of the last proxy that send the request. So this is out of choice.
In search of the same, i was studying the http headers and found
"X_FORWARDED_FOR" http header contains the comma separated IP address of all the nodes through which the request has been made, and the first one of them should be ideally the end users IP address.
But after implementing this solution, i was very happy to see the required result, but later on found, it doesn't always had the IP address of the end user as the first one, it sometimes has the one of the middle nodes(proxy server or router or gateway..) IP addresses.
Please let me know if my understanding of
"X_FORWARDED_FOR" is correct and if so why is it not having the IP address of the end user always.
Or is there any other way of capturing the same. Our environment is simple JSP/Servlets on
tomcat server.
Thanks a lot in advance.
Regards,
Srivatsa Katta