I have a website with nearly 99% of the content served from a Nginx cache (which is also the web server). To give you an idea around how simple the caching mechanism is, this is my cache key
I am implementing failover web server/cache using Cloudflare load balancing. One more web server in front of the origin web server. If the cache is a MISS or BYPASS, the request goes from the cache web server to the origin and refreshes both the machines. To warm up the redundant cache machine I copy/rsync over the cache files (once).
Here’s the tricky part: The Cloudflare load balancer is round robin and has geographical affinity. Which means that if the request were to hit the origin directly and it’s a MISS the cache won’t be replicated.
I thought of running unison on cron but that seems very ducktape.
What’s the right approach I can follow here?