Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

Get client IP address from JSP

Posted by Pankil Patel on March 30, 2010

<%
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") );
%>
Advertisements

One Response to “Get client IP address from JSP”

  1. Lea said

    Bon conseil, J’ai lu la plupart de tes article sur ton blog.. Je viens juste de m’interesser au blogging et j’espère pouvoir le faire également

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: