DNS record automatic failover

I have a simple failover setup that I am wondering is even possible with Cloudfare.

We provide remote access via Citrix.

I just want the DNS A record to change IP address if the IP address doesn’t respond to an HTTP request correctly for 10 minutes straight.

So, no load-balancing, but basically:

If this http request does not respond for 10 minutes then change the IP address for the A record to backup IP. Then after primary IP starts working again for 10 minutes, change the A record back.

Is this possible?

  • Elan

You can certainly write a script that checks for server responses for that site, and if it doesn’t respond for ten minutes, update the DNS record’s IP address. Switching back is more difficult, though. You can test the origin IP and then switch back. If the site fails due to that for ten minutes, the cycle repeats.

https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record

Or…use the Cloudflare load balancer’s failover feature only.

Thank you sdayman.

That script would need to run off-site and have caveats that it’s own Internet connection is working.

Question re: Couldfare’s load balancer failover feature. Can I use that with:

  1. An HTTP request check instead of a ping
  2. Can I use it without directing any data/web/Citrix traffic over Cloudfare’s network (just using it for DNS currently)?
  • Elan

I’ve not tried Load Balancer, but I believe it uses their Health Check mechanism, and that can be configured to do an HTTP/S check. I believe the Load Balancer does not need any records set to :orange: for it to work. Maybe another @MVP knows more about load balancer configuration.

1 Like

This is correct. Load Balancing is priced per DNS request, so proxying them will have a higher TTL and less cost, but it can work for :grey: subdomains with as low as 10s of TTL.

The check can be configured to be TCP and/or HTTP(S). You can’t even do a simple ping (I wish it was possible, but it’s not).

3 Likes

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