Smart UI Load Balancing - Location Based Multi-CDN

Answer from different CDNs for different locations

We have our page copies at four CDNs and we want to return the answer based on user location. And we have some complicated location-based conditions:

  • For visitors from the USA (country) - it will be the page copy hosted at Azure CDN.
  • For visitors from Europe (continent) - it will be from Akamai CDN.
  • For visitors from Australia and New Zealand (region) - it will be from StackPath CDN.
  • For all other visitors (Global) it will be from Cloudflare CDN.

Important: this is just an example, the pairs 'location-CDN' were taken randomly, this does not reflect the real picture of location-preferred CDNs.

Let’s log into our PerfOps Panel, go to FlexBalancers page create new Smart UI type FlexBalancer (let's call it 'locbasedbalancer'), set fallback to '' and keep the default 10 seconds TTL.


We have our balancer created, let's add our location-based answers:


First, we should create the answer for visitors from the USA (, Azure CDN). Fill in the hostname, use ‘Search’ field and select the United States:


Then, we select the Azure CDN from the ‘CLOUD PLATFORM’ list and press ‘Create answer’:


We press ‘Add new’ button and add the second one (for continent, it will be Europe,, Akamai CDN):


Then, we add another one for ‘region’ (Australia and New Zealand,, StackPath CDN):


And finally, the ‘Global’ answer (, Cloudflare CDN) - that will handle all other cases (when visitor is neither from the USA, nor from Europe, nor from Australia and New Zealand):


Now we have four answers and when the request is processed, FlexBalancer will apply sorting rules and check if any country-based answer matches the request location, if not- it will go to region-based answer, if no match - to continent based and if no match - the Global answer will be used:


We press ‘Test and publish’ button, confirm the Deployment and press 'Done'. Now we are ready to test our new FlexBalancer. We will emulate the DNS-request via dig-utility, using subnets and IPs from different countries.

Visitor with IP from The USA:


Visitor with IP from Europe (France):


Visitor with IP from Australia (region):


And visitor with IP from Japan should return Global answer:


And it does! Everything works as expected.