struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Graf-Waczenski <...@lsoft.com>
Subject Re: How to get the host name if proxy is configured
Date Mon, 23 Nov 2009 11:33:38 GMT
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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message