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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org