How to detect the IP address of a web client ?


Hi you experts:

My Java web application needs to know the IP address of each client.
Is there any Java technology to do it ?

Thanks in advance.

Albert.
LVL 2
AlbertYouAsked:
Who is Participating?
 
suprapto45Connect With a Mentor Commented:
>>"What if the client is connecting via a proxy server ?"
As far as my experiences tell me, request.getRemoteAddr(); is sufficient. If not, there is nothing else we can do. There may be a solution but I really do not have idea on that.

David
0
 
suprapto45Commented:
Hi Albert,

Yes, in your Servlet (or whatever technology you used), you can access the client's IP by request.getRemoteAddr();
0
 
AlbertYouAuthor Commented:

What if the client is connecting via a proxy server ?
Is there any way to get the real IP address of the web client instead of the proxy server ?

0
 
dasmaerConnect With a Mentor Commented:
Suprapto is right there, we can only find details supplied by the user browser and the connection to your app.  Google HTTP server variables and see what you can work with.
0
 
geoff2kConnect With a Mentor Commented:
Some proxy servers can be configured to forward the actual client IP address, but if we're talking about an internet application, I wouldn't count on it... you could always take a look at the headers you're getting at the server with request.getHeaderNames() and request.getHeader()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.