You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by topcoder1 <to...@gmail.com> on 2009/05/28 08:35:41 UTC

ProxyPass and client ip

I have an servlet application that requires to be know what the user's ip
address is.  
However since it has an apache http proxy sitting in front of it,  the
client's ip is always 127.0.0.1(localhost) when it reaches the servlet.  How
do I resolve this issue?  
ProxyPass /myApp http://localhost:8080/myappsserver
thanks!
-- 
View this message in context: http://www.nabble.com/ProxyPass-and-client-ip-tp23756017p23756017.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ProxyPass and client ip

Posted by Rainer Jung <ra...@kippdata.de>.
On 28.05.2009 08:35, topcoder1 wrote:
> I have an servlet application that requires to be know what the user's ip
> address is.  
> However since it has an apache http proxy sitting in front of it,  the
> client's ip is always 127.0.0.1(localhost) when it reaches the servlet.  How
> do I resolve this issue?  
> ProxyPass /myApp http://localhost:8080/myappsserver
> thanks!

Either look at the HTTP header X-Forwarded-For, or use the AJP protocol
(mod_proxy_ajp or mod_jk).

Concerning X-Forwarded-For: might be easiest, but be warned, that
usually each proxy between your client and your server will *add* the ip
of the previous system to this header. So you can not expect that to be
one single IP. The client is also able to send a forged X-Forwarded-For
header, so don't rely on it for security purposes.

AJP will be a bit more work in changing configuration, but AJP handles
the reverse proxy situation intrinsicaly. See

http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org