The easiest setup in load balancing history I cannot seem to figure out (!)

Hi everybody,

I’ve been digging through videos, articles and forums, but can’t seem to wrap my head around the topic of Load Balancing. More specifically, how to set it up using CloudFlare.

Here’s a summary of what I want to achieve:

  • Server “Primary” (1.1.1.1) is connected to a .app domain.

  • Server “Secondary” (2.2.2.2) is connected to a .dev domein.

These servers have different IP addresses, but contain the same applications and all domains are managed (and proxied) by CloudFlare.

Now, very simply put: if server “Primary” fails for any reason, I would like to direct traffic automatically towards server “Secondary”. Let’s call them “website.domain.app” and “website.domain.dev”. I realize how simple this may sound, but so far, I haven’t been able to figure out how this works.

So, that’s pretty much it. Is there someone willing to provide some instructions on how to achieve this using the LB settings inside of CloudFlare? Needless to say, I have tried every possible combination, all resulting in errors, most recently the Error 1000 “DNS points to prohibited IP”.

Instead of listing all my haystack (current settings) and asking you to find the needle, I think it would be more efficient if someone could point out the right instructions

Oh, and, not blaming CF, but… I found their instructions (or lack of) rather disappointing. Also, I tried to contact them directly to ask them this same questions, given how simple this request is and I must be overlooking something critical here (and I’m a paying customer), but they provide no way of contacting them directly.

Allright, hope this wasn’t become too much of a rant. If someone is willing to point me in the right direction, it surely would be appreciated.

Thanks.

I think you are slightly misunderstanding how the Load Balancer works in this situation. The web servers are Origins, and do not need to be attached to an individual domain per web server.

The simplest solution if you are on a Paid Plan is to use Zero Downtime Failover. This feature just requires you to configure two A or AAAA records for each hostname, and if one fails, Cloudflare will automatically fetch content from the other. Zero-Downtime Failover adds some latency to each request and you have no control over the failover order, so it might not be for everybody.

To achieve your goal, create two Load Balancer Pools, one for each Origin Server. I’ll call mine Primary and Failover. Then when you create the Load Balancer, you just select the appropriate Pool in the configuration:

2 Likes

Hi Michael,

Thanks for your help and clarification.

Although it’s probably just me, but could you perhaps elaborate a bit further on how you managed your Primary and Failover/Fallback Origin Pools? Better yet, would you be able to share a screenshot of the settings of each pool individually?

I think that will help me understand the differences between your setup and mine.

Thanks in advance.

Nothing special, and other than the name, description and IP address, they are identical:

There is also a basic monitor attached.

The use case here is “Use the Primary IP address unless it is unavailable, and then use the Failover IP address”, so there is nothing fancy.

Thanks for sharing your settings.

Unfortunately, I’m still having trouble wrapping my head around how this works, especially considering the DNS configuration.

As far as I understand, both origin pools refer to the same host name (e.g. app.website.com), correct? How is it possible for two servers to accept the same domain name given each one would also need their own SSL certificate?

This cross-referencing confusion is causing me a headache, to be honest. I know I must be missing something here, but not sure what it is.

If you would be willing to share the full setup, from DNS up until LB, I would very much appreciate it.

FYI In the meantime, I might just have figured it out… But I had that impression 16 times before I started this topic, so let’s not get our hopes up just yet :wink:

If you would be willing to share some more info regarding the DNS settings, I would still appreciate it, so I can verify and do a sanity-check, if you know what I mean.

FYI After specifying the Host Header value, it now redirects traffic from my primary server to my secondary server (after forcing an error).

However, it seems that by doing so, I am inherently tied to a specific domain, even though I have 18 load balancers left. Is there any way this Header value can be omitted, therefore allowing me to connect multiple “load balancing domains” to my primary and secondary servers?

I guess this is the part where things become somewhat unclear to me.

In my case I find it odd to witness how I am limited to 2 origins, but have 20 load balancers available. Since I can only add one domain/host at a time, it would make no sense to be able to add more. Also, CF is telling me I have 18 more pools left, but this also inaccurate in my case, since these pools are no different, given they utilize the same origins.

I know it must be me, but I consider this whole dashboard very unclear and a typical case of “implementation model” vs. “mental model”, last of which is personally preferred.

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