Score:1

Redirecting traffic from a server that is down to a static site

cn flag

I have a digital ocean server that uses cloudflare for DNS. If for some reason my DO server goes down I want to redirect the traffic to a DO static site app. My first thought is to use a Load balancer. Is this the right idea? I understand that a Load balancer can perform health checks on a server and reroute traffic in between the DNS and your server to other available servers.

The main reason I am posting is that when I look into loadbalancer docs on DO, what I read is that it redirects the next available server for the location. This confuses me a little. What I really want is just a health check for the main server and if it goes down to reroute all traffic to the static DO app site.

  1. Is a load balancer still the correct solution?

  2. Any specific configuration I need to do for the load balancer to get it to work for my situation?

pt flag
I don't think a DO load balancer is able to do what you want. If you're willing to stand up your own load balancer, something like haproxy would do what you want (see e.g [this article](https://www.exavault.com/blog/haproxy-load-balancing)).
Anders Kitson avatar
cn flag
Ok I will look into that. Would this potentially work as well. https://docs.digitalocean.com/products/networking/reserved-ips/quickstart/ From the first description seems promising.
Anders Kitson avatar
cn flag
Based on this diagram, could I not have one loadbalancer go to the server and one go to the static site. https://docs.digitalocean.com/screenshots/reserved-ips/ha-diagram-animated.3c24985b42d48e7a307d837a4ac4201e24febf7c8fe386035885b2a096a43712.gif
pt flag
Oh, maybe! I didn't thoroughly read the DO docs, so if you've found something it's certainly worth trying it out.
Anders Kitson avatar
cn flag
Yeah I found a way to solve my problem without automating it with healthchecks, but I think i could, it was looking a little expensive to implement two load balancers, so I am just going to have a manual reserved IP switch if something goes wrong. Its not a huge issue if it goes down temporarily. I'll post an answer if I find a way to automate easily and cheaper.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.