Detecting user region

Hi, What is the proper way to get the user's region inside the worker script? Getting the country works fine (cf-ipcountry') but the region does not seem to work with cf-region.
3 Replies
Beef
Beef•8mo ago
IMO - the most specific you can get within CF is the colo-id "EdgeColoID". otherwise you'll rely on country but in order to get more granual you'd have to do custom geo lookups. def do not recommend utilizing ASNs
Tin Cap
Tin Cap•8mo ago
Usually what people do for more detailed geolocation is using something like MaxMind.
Chaika
Chaika•8mo ago
You can get it off the request object, ex request.cf.region https://developers.cloudflare.com/workers/runtime-apis/request/ There's also regionCode, continent, city, country, etc Example of that information on your ip: https://chaika.dev/ CF"s IP geolocation fields/information is all Maxmind powered, no need to use something external 🙂 I think they include all the geo information maxmind has, besides maybe confidence and some of the non-geoip maxmind fields like connection type
Want results from more Discord servers?
Add your server
More Posts
Unable to login to my account, "Code 1022" over and over. I have reset the password twice.Any idea how to fix this? It keeps saying wrong password, even though I have reset the password twic1.1.1.1 Connection issueMy macbook used to work fine connecting, but now it only connected 1/100 times and stays on establisSite under DDos attack Try complete captcha to continueI've been getting this issue in my WordPress website when I try to load my website. I've tried usingHey I've got a question, does anyone have a package to handle stream respones or something?I'm trying to stream back the streams from openai's chat but it doesn't seem to work. I don't want tcan I have a look at the toml file alsocan I have a look at the toml file? also, are you using pages or workers?Dashboard UI BugNot the biggest deal, but the icon color for D1 on the Workers pricing page has been broken for awhiIf I called waitUntil(callback()) in a loop just say loop length is 100, so does that mean the...?If I called waitUntil(callback()) in a loop just say loop length is 100, so does that mean the callbPipeing cfssl bundle into cfssljson fails with 'Request failed:'when i run```bash $ cfssl bundle -ca-bundle=root.pem -int-bundle=intermediate.pem -cert=admin.pem | Pages and Strong ETagsDoes Pages automatically generate strong ETags that we can configure as an Enterprise customer? We hIssue with DO connected to worker incrementally increasing on every executioncan someone take a look at this issue and help us figure out what is wrong? - when we call the wate