How to get client IP Address in Netty http server
Ngoc Dao
ngocdaothanh at gmail.com
Tue Jul 19 19:18:15 EDT 2011
If the HTTP server is behind proxies, the IP of the original client is
the first element of the X-Forwarded-For header.
To make sure that this header is set by the proxies, not to be fooled
by the original client (may be a hacker), check if IP of the last
proxy is in your white list.
See the source code of Play framework:
https://github.com/playframework/play/blob/master/framework/src/play/mvc/Http.java
https://github.com/pepite/Play--Netty/blob/master/src/play/modules/netty/PlayHandler.java
On Wed, Jul 20, 2011 at 3:02 AM, Ioan Eugen Stan <stan.ieugen at gmail.com> wrote:
> 2011/7/19 George <georgel2004 at gmail.com>:
>> Hello,
>> Is there something like request.getRemoteAddress() in http server to get the
>> ip address of the connected client ?
>> Is there any other way of getting the ip address of the client?
>
> You call getRomoteAdress() on a channel instance. Check the api:
> http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/Channel.html
>
> --
> Ioan Eugen Stan
> http://ieugen.blogspot.com/
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
More information about the netty-users
mailing list