0

Accounts for a service are stored regionally. For example, US accounts on US servers, European accounts on European servers. All are behind one DNS name. When you first connect, a Global Server Load Balancer sends you to the nearest location. Since your account might be anywhere, a check is made as to where your account actually resides and that information is cached for every subsequent visit. Now, when you visit the site from within that region, you are redirected to connect to the location your account resides in regardless of where it is located without having to go through the process of rechecking. Is this possible? How to implement? What to use as a cache?

1 Answers1

0

After your application has confirmed the correct location for the user then why not just send a full location redirect to https://usa.example.com/ ?

If you cant do it in the application then you could do it on the load balancer, and example with HAProxy would be:

http-request redirect location https://usa.example.com/

But how do you do the IF part? Well either insert a header from your app that the load balancer can read i.e. x-myappcountry=USA Or even create your own GEO-IP Database - which is a faff?

https://icicimov.github.io/blog/devops/Haproxy-GeoIP/