Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geoip not returning city data #53

Closed
jhiraygit opened this issue Mar 9, 2013 · 13 comments
Closed

Geoip not returning city data #53

jhiraygit opened this issue Mar 9, 2013 · 13 comments

Comments

@jhiraygit
Copy link

Hello,,

I am using GeoIp in my node application . It was working fine but since last couple weeks stops returning city data. There was no code change I can recall.

nodejs code :

var geoip = require('../lib/geoip.js');
var geoip = require('geoip');
var City = geoip.City;
var city = new City('/site/node_modules/geoip/deps/GeoIP-1.4.8/data/GeoLiteCity.dat');
var city_obj = city.lookupSync(req.header('X-Forwarded-For'));

console.log(city_obj);

{ country_code: 'US',
country_code3: 'USA',
country_name: 'United States',
latitude: 38,
longitude: -97,
continent_code: 'NA' }

node -v
v0.6.18

Thank you,
WG

@kuno
Copy link
Owner

kuno commented Mar 9, 2013

thank your report.

Will take a look ASAP.

@kuno
Copy link
Owner

kuno commented Mar 9, 2013

I saw you are on node 0.6.x.

If possible, please update to node 0.8.x, the support for node 0.6.x is now been obsoleted

@jhiraygit
Copy link
Author

Thank you Kunno, let me upgrade node to 0.8.x

@jhiraygit
Copy link
Author

Hi Kunno, now I have node v0.8.6, however I see same issue. Thank you.

@kuno
Copy link
Owner

kuno commented Mar 12, 2013

Do you use the latest city data from maxmind?
Are you sure there are actual ip address in req.header('X-Forwarded-For')?

Because the city.lookupSync method is works me without any problem if I provided the valid ipv4 address to it.

@jhiraygit
Copy link
Author

Hi Kuno, I have latest city data file from maxmind. req.header('X-Forwarded-For') also gives me correct IP address. I also noticed some of IPs are getting city code and some are not.

What I found is with certain IP addresses city.lookupSync does not return city data.

Thank you.

@kuno
Copy link
Owner

kuno commented Mar 12, 2013

@jhiraygit

Can you give me some example ip address that didn't return data?

@jhiraygit
Copy link
Author

try this one : 50.152.210.240

@kuno
Copy link
Owner

kuno commented Mar 12, 2013

it return some data on my machine

> city.lookupSync('50.152.210.240');
{ country_code: 'US',
  country_code3: 'USA',
  country_name: 'United States',
  latitude: 38,
  longitude: -97,
  continent_code: 'NA' }
>

@jhiraygit
Copy link
Author

right, I get same data but it does not have city data

@kuno
Copy link
Owner

kuno commented Mar 13, 2013

@jhiraygit

this is a normal situation, it turns out that for some ip addresses the maxmind's city database is not accurate enough to have the actual info about city.

this is normal for free version db, not sure the situation in commercial version.

@jhiraygit
Copy link
Author

Thank you Kuno. Strange thing is it was showing city fine for some time and suddenly stopped.

@kuno
Copy link
Owner

kuno commented Dec 28, 2013

Done.

@kuno kuno closed this as completed Dec 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants