Setting up a 2nd web site has a backup, how do I configure Cloudflare to forward traffic between the production and backup URL?
Cloudflare handles sites at the DNS level. But you can add a Page Rule to do a redirect:
example.com/* and add a Setting for a Forwarding URL (302) to:
The $1 means to use the same path/file as the original request.
Once you add this second fowarding address when you want to have traffic forward back to production do you remove the address or disable it.
Disable, though this isn’t a desirable failover strategy, as visitors will start visiting a different URL.
A better strategy would be to use a Load Balancer with Failover:
There is a load balancer in both data center on my side Prod and Backup Site.
With CloudFlare we want to have traffic going to the backup site only when the production site goes down.
I thinking all I need to do is do a redirect and only point traffic to the backup as necessary.
The one site production that is setup now is going to a single server, the second site backup has two server and a load balancer on the other end.
what is the best setup from Cloudflare propective to forward traffic tot he backup site. Do I use a Page Rule redirect?
Now that I think about it, if the backup server is configured to respond to the same domain name (that would be good), then you can manually update the DNS record. With TTL set to Automatic (as is the case for ), the switchover will take less than five minutes.
So just change the IP address in DNS and visitors will hit the backup server instead.
But if the backup server is configured as a different hostname, such as sub.example.com, then use a Page Rule.