getRemoteHost() will return the IP of the client making the last http request. This is not a problem if your users make requests directly to your application server, but if you have a reverse proxy like a load balancer, getRemoteHost() will return the IP of the reverse proxy, which probably isn't what you're looking for.
It's best practice for the load balancer to preserve this information by setting the X-Forwarded-For http header, which will be the IP of the originating request. http://en.wikipedia.org/wiki/X-Forwarded-For -Dan On Mon, Nov 21, 2011 at 4:10 PM, Paolo <[email protected]> wrote: > Alle lunedì 21 novembre 2011, François Meillet ha scritto: > > ((ServletWebRequest) > RequestCycle.get().getRequest()).getContainerRequest().getRemoteHost() > > > > François > > > getHeader("X-Forwarded-For") return null string!! > I use getRemoteHost() and it works! Thanks to all!! > > P.S. > I test it only on localhost (ip 127.0.0.1) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
