Tutorials4u.net Forum
Get client IP address from JSP - Printable Version

+- Tutorials4u.net Forum (http://www.tutorials4u.net/forum)
+-- Forum: Discussion Forum (/forumdisplay.php?fid=1)
+--- Forum: JSP (/forumdisplay.php?fid=3)
+--- Thread: Get client IP address from JSP (/showthread.php?tid=37)


Get client IP address from JSP - tutorials4u - 12-15-2010 01:35 AM

<%
out.print( request.getRemoteAddr() );
out.print( request.getRemoteHost() );
%>

You may not get the real client IP if a the client is behind a proxy, you will get the IP of the proxy and not the client. However, the proxy may include the requesting client IP in a special HTTP header.

<%
out.print( request.getHeader("x-forwarded-for") );
%>