try request. getRemoteHost() method, if the client not use a gateway ip of client return by this method. else this method returns the ip of gateway.
In Java, you can use HttpServletRequest. getRemoteAddr() to get the client's IP address that's accessing your Java web application.
I need to get the IP address of the client in the JSP page. I have tried the following ways:
request.getRemoteAddr()
request.getHeader("X_FORWARDED_FOR")
request.getHeader("HTTP_CLIENT_IP")
request.getHeader("WL-Proxy-Client-IP")
request.getHeader("Proxy-Client-IP")
request.getHeader("REMOTE_ADDR")
However, none of those ways did return the desired IP address. How do I get the IP address of the client in the JSP page?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With