Is there any way that I could get the original IP address of the client coming to the server?
I can use request.getRemoteAddr()
, but I always seem to get the IP
"x-forwarded-for" request header contains the original client IP if using a proxy or a load balancer. But I think not all proxies/lb adds this header.
Here some java code to parse the header: http://www.codereye.com/2010/01/get-real-ip-from-request-in-java.html
If this header is not present then I would proceed as @Bozho suggests