on 03-04-2015 3:40 AM
Hi,
I have a simple HTML5 application running on HCP. I need to find out the IP address of the client running this application.
any idea how to do this ?
thnx,
Pramod
Hello Pramod,
As far as I know, this can not be done using just purely javascript / HTML5. I have two ideas on how you could accomplish this through other ways:
Regards,
Serban
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is true, although not standardized, it is used by most / all proxy servers (a simple google search will reveal that it is a "de facto" standard). This header check would be needed because the getRemoteAddr() method will return null if the user is behind a proxy. Unfortunately, IPs can be masked by the infrastructure, so there is no 100% proof way that gets the real IP. You have to work with what you have
If you use Java Servlet based web container the implementation of getRemoteAddr will try to figure out the last communication peer ip address. In HCP we use Apache Tomcat as a web container hence getRemoteAddr is implemented in a way it will not return null. Example : NIO non blocking connector (o.a.coyote.http11.Http11NioProcessor) Of course that differs from the client origin in case of proxy or reverse proxy instances being part of the communication path.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.