Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get IP address of client in JSP

Tags:

People also ask

How to get client machine IP address in JSP?

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.

How to get IP from request Java?

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?