Yes, what Robert said is perfect, you can't get the remote host name. 

If you so critical about that client information then you can some
Geographic location software's like this to find that out
http://www.ip2location.com/. In one of our POC, we used this to identify the
country where our user is residing. If somebody sitting in India using a
proxy server located is UK then this software show only UK. Beware of this.
Since the possibility of this is very rare, we neglected it.

~Muthu

-----Original Message----- 
From: Robert Graf-Waczenski [mailto:r...@lsoft.com] 
Sent: Monday, November 23, 2009 5:04 PM
To: Struts Users Mailing List
Subject: Re: How to get the host name if proxy is configured

Mageshwaran schrieb:
> Hi All,
>
> In my application, am using  request.getRemoteHost() to get the host 
> name where the client is running. But it is returning the proxy 
> address if configured instead of host address/ host name. Can any one 
> help me to solve this issue?
>
> Thanks in Advance,
> Magesh.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Short answer: You can't. A proxy by definition executes the request on
behalf of the client and can therefore completely mask the actual client
host address. There are, however, non-RFC-complient request headers that
you might query:

request.getHeader("x-forwarded-for")

But be warned: Many proxies don't supply this information correctly, so
you have to live with what getRemoteHost() gives you.

Robert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to