Search code examples
apachednsreverse-dnsgoogle-cloud-dns

Redirect domain dns to different server by country ip


I have one domian with this name "example.com" but i want any time user come to my domain redirect to different server by user country ip

user ip = 192.168.1.1 : USA Go To "example.com" with ip => 127.0.0.1 in USA

user ip = 192.168.1.2 : Canada Go To "example.com" with ip => 127.0.0.2 Canada


Solution

  • You'll need to set up a HTTP(S) Load Balancer

    The following quote was taken from the above link:

    Creating a cross-region load balancer

    You can use a global IP address that can intelligently route users based on proximity. For example, if you set up instances in North America, Europe, and Asia, users around the world will be automatically sent to the backends closest to them, assuming those instances have enough capacity. If the closest instances do not have enough capacity, cross-region load balancing automatically forwards users to the next closest region.

    See the following link for a guide on how to set this up

    Creating Cross-Region Load Balancing