How to exclude specific data centers (colos) from Worker routing?

PROBLEM: - Korean customer gets routed to Hong Kong (HKG) data center 🇭🇰 - External API (Gemini API) returns: "User location is not supported for the API use." ❌ - Customer can't use service they paid for ⚠️ ⚠️ This behavior automatically exclude all Asian users from my app! I had a similar issue with a Vietnamese customer. ⚠️ ⚠️ Even worse: During freemium testing, this same Korean user was routed to "NRT" (Tokyo Narita) and everything worked perfectly! The unpredictable routing changes make it impossible to guarantee service availability without the ability to blacklist problematic colos. Current setup: - Cloudflare Worker calling Google Gemini API that has geographic restrictions - Error: 400 Bad Request - "User location is not supported" - Happens specifically from HKG colo Question: Is there ANY way to exclude specific colos (like HKG) from routing? Or force certain geographic regions to use different data centers? Alternative solutions welcome: - Route Korean traffic to Tokyo/Singapore instead of HKG? - Force specific countries to use US/EU workers? - Any Cloudflare feature I'm missing? This is blocking paying customers from using our service. Any help appreciated! 🙏
4 Replies
Cyb3r-Jak3
Cyb3r-Jak35mo ago
The ISPs choose the Cloudflare Datacenter that people are routed to. The only guaranteed way is to run in certain areas is the Data Localization enterprise add-on. You could also look to use durable objects with location hints: https://developers.cloudflare.com/durable-objects/reference/data-location/#provide-a-location-hint
Cloudflare Docs
Data location
Jurisdictions are used to create Durable Objects that only run and store data within a region to comply with local regulations such as the GDPR or FedRAMP.
adilson
adilsonOP5mo ago
@Cyb3r-Jak3 Thanks for the suggestions! Unfortunately, the Data Localization enterprise add-on is too expensive for my use case, and I don't use Durable Objects in my architecture. Quick follow-up question about Smart Placement: https://developers.cloudflare.com/workers/configuration/smart-placement/ Does Smart Placement factor in HTTP error rates (400/500 status codes) when determining "performance", or does it only consider request duration? My Worker calls Gemini API with highly variable response times (500ms to 30s ). Some regions return fast 400 errors, others return slow but successful responses. Will Smart Placement route to the "fast error" region, or does it understand that errors = bad performance regardless of speed?
Cloudflare Docs
Smart Placement
Speed up your Worker application by automatically placing your workloads in an optimal location that minimizes latency.
Cyb3r-Jak3
Cyb3r-Jak35mo ago
I am pretty sure that it only consider request duraction
adilson
adilsonOP5mo ago
😥 I see. Thanks for your help

Did you find this page helpful?