You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
console.log(ip);
var geo = geoip.lookup(ip);
console.log(geo);
yields
::ffff:123.202.30.78
null
My geoip-lite data directory contains:
-rw-r--r-- 1 root root 40M Feb 11 15:20 geoip-city-names.dat
-rw-r--r-- 1 root root 23M Feb 11 15:20 geoip-city.dat
-rw-r--r-- 1 root root 1.3M Feb 11 15:20 geoip-city6.dat
-rw-r--r-- 1 root root 1001K Feb 11 15:20 geoip-country.dat
-rw-r--r-- 1 root root 726K Feb 11 15:20 geoip-country6.dat
(root because it's in a docker container)
Looking up the IPv4 version (123.202.30.78) works as expected. Looking
up ::ffff:123.202.30.78 on https://www.maxmind.com/en/geoip-demo works
as expected too.
A workaround is:
ip = ip.split(:).slice(-1)[0]; // works both on IPv4 and IPv6 representations of IPv4 addresses
The text was updated successfully, but these errors were encountered:
Using my current IP address:
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
console.log(ip);
var geo = geoip.lookup(ip);
console.log(geo);
yields
::ffff:123.202.30.78
null
My geoip-lite data directory contains:
-rw-r--r-- 1 root root 40M Feb 11 15:20 geoip-city-names.dat
-rw-r--r-- 1 root root 23M Feb 11 15:20 geoip-city.dat
-rw-r--r-- 1 root root 1.3M Feb 11 15:20 geoip-city6.dat
-rw-r--r-- 1 root root 1001K Feb 11 15:20 geoip-country.dat
-rw-r--r-- 1 root root 726K Feb 11 15:20 geoip-country6.dat
(root because it's in a docker container)
Looking up the IPv4 version (123.202.30.78) works as expected. Looking
up ::ffff:123.202.30.78 on https://www.maxmind.com/en/geoip-demo works
as expected too.
A workaround is:
ip = ip.split(:).slice(-1)[0]; // works both on IPv4 and IPv6 representations of IPv4 addresses
The text was updated successfully, but these errors were encountered: