I want to get client's IP address when it log in into the system. I am using request.getRemoteAddr() but it returns server's IP address instead of client's IP. I also tried request.getHeader("X-FORWARDED-FOR")
You can't. Not reliably. All the clients on my backend LAN, for example have the apparent IP address of 18.104.22.168, but that's not their real IP addresses. They use addresses from the private (non-unique range), but pass through a NAT router, which assigns a fixed public address.
An IDE is no substitute for an Intelligent Developer.
Joined: Oct 27, 2009
If its true then i will have to revert this application from client side. It is working fine at our testing servers and at our developement center but at cliet side it gives same addresses........
getting a client IP in an application running behind load balancer is not possible. most of the time you will get the same IP address and cannot distinguish between the users.
Try this URL : http://whatismyip.com/ and see the ip you get and what is in the end logged in the web servers/ load balancer logs..
What are you trying to achieve here ?? may be i can help you with and alternative approach ?
Thanks all you guys for replying
and for NIV actually i store ip address of client when he login into my system and i made a report which gives information to user of Ip address and login time for each and every login made in system But right now it is showing same ip for all records.