un33k / node-ipware

Returns the real IP address of users in Node.js
MIT License
124 stars 17 forks source link

Only one type of IP #7

Closed robertstefan closed 8 years ago

robertstefan commented 8 years ago

The server where I'm running node doesn't have support for IPv6; ergo the result address is always prefixed by ::ffff:. Is there a way to get only the IPv4 address ?

Thank you.

un33k commented 8 years ago

If there is no IPv6, it should automatically return you IPv4.

robertstefan commented 8 years ago

Agreed, but unfortunately, I always get ::ffff:. :(

un33k commented 8 years ago

If you are behind a proxy server (AWS ELB, Nginx .etc), see which header you are getting. Then adjust the IPWARE_HTTP_HEADER_PRECEDENCE_ORDER to reflect that.

robertstefan commented 8 years ago

Thanks. I will take a look at it asap and I'll come back with a reply if anything wrong.

robertstefan commented 8 years ago

So, I finally was able to get the time to implement the changes that you specified. But, I have the following conclusions:

Maybe there is something I missed, maybe something else; have no idea.

Unfortunately, i had to remove the package from the project, but in the end it did help me to implement the logic directly into the project.

un33k commented 8 years ago

ipware is at the mercy of the upstream proxy server. In other words, it can only return the ip address that has been passed down by the proxy server.

You want to take version 0.0.8 for a spin as it now supports hyphenated header keys.