Live data from Hacker News

I made a simple geolocation service

maxkostinevich.com

31–40 of 187 posts

Re: I made a simple geolocation service

#31
post #25

I had to tackle this problem as well for a small project and found that I could just send a GET request to https://www.cloudflare.com/cdn-cgi/trace and parse the response with a simple regex: /loc=(\w*)$/gm The response time averages 10ms and is free, granted I'm not sure if there is a ToS or anything attached to this endpoint, I've only found non-conclusive discussion here https://community.cloudflare.com/t/what-are…

I mean, you can do that but it's a hideous hack and we might change that output at any time and you could easily hit DDoS mitigation or other security features if you do that. That endpoint is used for debugging and is in no way an API.

I'd advise you to just create a Cloudflare Worker if you want do this. You'll get more reliability etc. and Workers have a very generous free tier.

Re: I made a simple geolocation service

#32

Well that's a bit more than 2 requests per second on average. Sure you may have some bursts once in a while, but nothing a 3€ VM can't manage IMHO.

The only thing I like about lambda, is that your code could easily be deployed to different geo locations

Re: I made a simple geolocation service

#33

Well that's a bit more than 2 requests per second on average. Sure you may have some bursts once in a while, but nothing a 3€ VM can't manage IMHO.

A Pi should be able to handle this too.

A Pi is basically yesteryear’s beefy rack server.

Re: I made a simple geolocation service

#35

Well that's a bit more than 2 requests per second on average. Sure you may have some bursts once in a while, but nothing a 3€ VM can't manage IMHO.

The only thing I like about lambda, is that your code could easily be deployed to different geo locations

You can also easily spin up a VM in a different geographic location.

Re: I made a simple geolocation service

#36
Slightly off-topic.

AFAIK, an unresolved problem is a proper geolocation service - at least for city level resolution - for mobile IP addresses. There are some services in this field (digital element), but they are very unreliable.

Re: I made a simple geolocation service

#38
post #35

Earlier quoted context omitted.

The only thing I like about lambda, is that your code could easily be deployed to different geo locations

You can also easily spin up a VM in a different geographic location.

That's true, but likely not as close to the customer as CF Workers on edge. And certainly not as easy, as CF does all that automatically.
Post reply on HN