The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

How to do it, when server or client is behind a proxy

Posted by pavan on December 18, 2001 at 2:35 PM

My appserver is behind IIS, when i make the request.getRemoteAddr, it is returning the IP of the m/c which is hosting IIS (proxy). I think the situation would be same when the client is behind a proxy server. request.getRemoteAddr will return the proxy address.
Is there any work around for this.
Thanks,
pavan
> Mattias,

> In the servlet, use request.getRemoteAddr() - inherited from ServletRequest. This returns the IP address of the agent that sent the request as a String. Also, request.getRemoteHost() will attempt to get the fully qualified host name. If it cant resolve the name however, the IP address will be returned as in getRemoteAddr().

> Hope this helps.

> Regards,

> Jody






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us