Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Easy way to get geo from ip. I hate a lot of the options: downloading binarys or using google's that just regulates you.



https://ipinfo.io works well. Alternatively, CloudFlare also works well if you just need the country code, which it can attach as an HTTP header to each request.


Easiest solution is to put Cloudflare in front of your site for free and they'll pass in the geo data in the request header. Agreed that playing with binaries that you have to periodically download is horrible.


We are using the geo lookup api fram maxmind, with success. Gets quite expensive though, if you are not careful


MaxMind works great for us.


I used http://ip-api.com/json, the precision varies but at least the country level is fine. From the limited tests I did I was in the 5 km radios range.


There was a solution for this on HN not a week ago..


Here it is: https://ipinfo.io


These free databases are really inaccurate in many cases compared to e.g. Maxmind. E.g. this thinks my IP address is 100 km away near the German border, but Maxmind's commercial DB puts me a 7 minute walk away in the center of Amsterdam.

They're better than nothing, but be careful when relying on them for anything you need accurate Geo-IP info for.


I also don't recommend free solution for serious business. This can be critical for E-Commerce which uses GEO-Locking.

For customers that live on the borders it is very important that correct country is selected.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: