Get real client IP in a Servlet [duplicate]

I suppose that your problem is that you are running server somewhere in local network, so you get your IP in that network. However when you are trying to use online service that discovers your IP address your IP is the IP of your service provider’s router or something like this. Using request.getRemoteAddr() is correct. This is what such services do and they do not have other facilities.

Leave a Comment