Have one subdomain for API Backend but redirect to different server based on location?

I’m wondering if this is possible to have sometthing like:

api. example .com which is configured to be consumed by the front end.

Then based upon the user’s location, they get routing to api-london.example.com or api-newyork .example .com

The idea is to reduce the latency that the user experiences.

Is that possible with Cloudflare?

It’s like when you ping google.com
You get:
ping google. com
PING google. com(lhr48s13-in-x0e.1e100. net (2a00:1450:4009:81c::200e)) 56 data bytes

Where it’s a geographic server.

That would be essentially Cloudflare’s basic setup, but I presume you are talking about a host which runs an API so you wont be able to take advantage of Cloudflare’s caching, will you?

In that case you could look into Cloudflare’s load balancer, which offers AFAIK geographically distributed connections of that sort. Alternatively you could also look into Argo Tunnel which would allow your different instances to connect to their (and in turn the users’) nearest datacentre.

I see. So it’s not possible on the DNS level but via the cloudflare load balancer?

There are many things possible on a DNS level, but it all depends on the use case.

Is my previous assumption correct?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.