by maxko on 7/24/20, 7:17 AM with 176 comments
by tastytacos on 7/24/20, 12:56 PM
by sudhirj on 7/24/20, 8:50 AM
https://blip.runway7.net https://github.com/runway7/blip
I lost track of the consumer apps I've used this on and still haven't received a $1+ bill.
by skuhn on 7/24/20, 9:45 AM
Programmatically populating the response body, as in the Cloudflare worker example from the post, is better than going to the origin just to echo some headers back in the response. To me, something like Fastly's VCL config language is even simpler. It directly executes on every CDN edge node worldwide upon request.
For example, I just whipped this up on Fastly using VCL. It returns GeoIP as json data for your IP at the root path:
Or if you want a particular IP, just append it to the path:
http://geo.zombe.es/2a04:4e42:600::313
You could do the same via query params, headers, etc. Have URL endpoints that only return some of the data, and so forth.
The VCL syntax gets a little gross when you handle quoting strings and assembling json and testing if the string is empty, but it gets the job done.
Of course what you might want from GeoIP data may not be what you get. It's really kind of a useful kludge that gets treated sometimes as a panacea.
This dataset right now thinks that I'm about 5 miles east of my location, but when subnets are repurposed it could be much more significant. And the data sources are always changing, so who knows what it will think tomorrow.
by jasonlingx on 7/24/20, 8:30 AM
by itsjloh on 7/24/20, 8:39 AM
by waffl on 7/24/20, 8:55 AM
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-the-terms-of-use...
by speedgoose on 7/24/20, 8:17 AM
by ignoramous on 7/24/20, 2:15 PM
I got sent a (frustratingly incorrect) bot reply to a ticket and a reminder that Enterprise / Business / Pro customers are priority (in that order) even though I pay for Workers. It has been an uphill battle to get someone to take a look at the ticket so far. Thankfully, we haven't gone to production yet, but as a consequence, now need to plan to add mitigation in scenarios where Workers blacks-out our traffic (but Support can't be of immediate help because "free customer").
[0] https://community.cloudflare.com/t/workers-and-sub-requests/...
by rightbyte on 7/24/20, 11:21 AM
If the exact location is important geoip is not accurate enough anyway. Forwarding to regional sites automatically is just annoying when it doesn't work properly or someone is traveling abroad.
by walrus01 on 7/24/20, 8:56 AM
https://arstechnica.com/tech-policy/2016/08/kansas-couple-su...
https://www.theguardian.com/technology/2016/aug/09/maxmind-m...
https://mashable.com/2016/08/11/ip-addresses-kansas/
ISP perspective here: Geolocation by granular /24 to /20 sized block of ipv4 space is often wildly inaccurate on a regional basis. It's entirely possible for the ARIN registration (used by maxmind) to be a street address in Seattle, but serving end user ISP customers a 4.5 hour drive away in a far eastern corner of WA state.
by efesak on 7/24/20, 9:07 AM
by wingi on 7/24/20, 8:24 AM
https://www.united-coders.com/christian-harms/detailed-perfo...
by fs2 on 7/24/20, 9:01 AM
It's also free and fast but with services like these I always wonder how long they manage to stay free.
by bellwether on 7/24/20, 8:11 AM
by gitgud on 7/24/20, 9:42 AM
6 million requests per month is only 2.2 requests per second, a raspberry PI could do this (technically).
by jamesponddotco on 7/24/20, 4:03 PM
Now I have been thinking about opening it up for more people because while there are a variety of these services out there, one more does not hurt — it already exists, and works, so who knows, maybe more people would like to use it. The code is open, and access logs go to /dev/null; I could probably add a read-only SSH user for people to confirm that for themselves.
Geolocation could easily be added to it, but then comes my question: is there any use-case for geolocation APIs that does not involve tracking users for shitty purposes?
I was excited about adding this feature because I am using pure NGINX for it, and it was a fun learning experience, but I asked myself that question when I started writing the documentation for the website, and I still do not have an answer. Marketing material for other APIs that offer geolocation usually have user tracking as a selling point.
Personally, I have no use for geolocation, and if all use-cases involve tracking without consent users, and breaking their privacy, I want no part in that.
by whatl3y on 7/24/20, 8:34 AM
by sradman on 7/24/20, 12:13 PM
[1] https://developers.cloudflare.com/workers/reference/apis/req...
[2] https://docs.aws.amazon.com/AmazonCloudFront/latest/Develope...
[3] https://cloud.google.com/appengine/docs/standard/go/referenc...
by ignoramous on 7/24/20, 6:05 PM
There's nothing stopping a script-kiddie from thundering away at the Serverless endpoint resulting in an unexpected and quite high billables [0].
As for Workers specifically, Cloudflare's rate-limiting plan makes the whole thing 10x expensive at $10 for 2,000,000 good-requests [1] + $1 for 2,000,000 Workers requests. Other cloud providers I don't think fare any different.
[0] https://community.cloudflare.com/t/how-to-protect-cloudflare...
[1] https://support.cloudflare.com/hc/en-us/articles/11500027224...
by contravariant on 7/24/20, 1:07 PM
by EE84M3i on 7/24/20, 8:43 AM
by scottndecker on 7/24/20, 4:43 PM
by mcculley on 7/24/20, 10:57 AM
> on average the response took somewhere between from 200ms to 500ms
I'm getting latency of 66ms to 126ms with some simple Java code running on AWS Lambda using provisioned concurrency. I find the latency is just fine for most use cases.
by csunbird on 7/24/20, 8:40 AM
by grizzles on 7/24/20, 8:37 AM
by ColdHeat on 7/24/20, 2:25 PM
IP to country is fairly easy and I open sourced all the scripts and the database itself [0].
But IP to city is much harder, I'm not actually sure it's viable for anyone to do that without relying on some other 3rd party service.
I'd be very interested to hear if anyone knows how to pull that off in an open sourceable manner.
by Nextgrid on 7/24/20, 8:56 AM
by GiantSully on 7/24/20, 2:59 PM
by layoutIfNeeded on 7/24/20, 10:06 AM
Would this be cheaper than running these services?
by sheeshkebab on 7/24/20, 11:31 AM
I guess it’s ok for a basic consumer website, although it’s not exactly equivalent to ip geocoder databases/services - they allow passing ip addresses as part of geocoding request.
by freelancercv on 7/24/20, 3:08 PM
by pereiratr on 7/24/20, 8:21 AM
by tuananh on 7/24/20, 8:59 AM
https://developers.cloudflare.com/workers/templates/pages/co...
by fasteo on 7/24/20, 9:21 AM
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.
by stereo on 7/24/20, 9:21 AM
by ing33k on 7/24/20, 12:23 PM
Nginx + GeoIP2 module sets a HTTP request header and proxies the request to the golang app.
The go app does a lookup from redis, based a combination of country header and some url params and responds back with a redirect header.
Hosted it on a t2 medium in EC2 and I have seen it easily handle ~1500 requests / second without any issue.
by hluska on 7/24/20, 3:44 PM
by priyaaank on 7/24/20, 11:39 AM
by llaolleh on 7/24/20, 6:18 PM
by sigmonsays on 7/24/20, 1:25 PM
by crispyporkbites on 7/24/20, 8:07 AM
by teknopaul on 7/24/20, 11:44 AM
by PaywallBuster on 7/24/20, 8:09 AM