What is the correct architecture for multi-region failover with Firebase Hosting and Cloud Run: Google Load Balancer or Cloudflare?
I'm trying to design a scalable, global architecture for a web application that uses Firebase Hosting and GCP
Our goal is to achieve high availability even on “incident day”, when Firebase Hosting can forward a request to a Cloud Run impacted region.
Background:
Our Current Flow: User -> DNS -> Firebase Hosting -> Single Region Cloud Run
Architecture 1: Google Cloud Load Balancer
In this scenario, we could use a Google Cloud Load Balancer as the single-entry point for all traffic as research we can achieve something like this.
New Flow: User -> DNS -> Google Cloud LB -> Multi Region Cloud Run
Our Confusion:
How do we resolve the DNS conflict?
Does this architecture bypass the Firebase Hosting CDN and the rewrites?
Architecture 2: Cloudflare
In this scenario, we could use Cloudflare for its CDN and potentially its load balancing capabilities, keeping the backend on Google Cloud simpler and untouched.
New Flow: User -> DNS -> Cloudflare (as CDN and Load Balancer) -> Firebase Hosting (as reverse proxy) -> Single-Region Cloud Run
Our Confusion:
What is the correct way to configure Cloudflare in front of Firebase Hosting?
Can Cloudflare's Load Balancer be used to provide active health checks and failover for our Cloud Run, even though the requests are proxied through Firebase Hosting?
Are there any specific 'gotchas' in this setup, such as the SSL/TLS mode on Cloudflare, to ensure the connection to the Firebase origin is secure and that firebase.json
rewrites still function correctly?
If you want Firebase Hosting rewrites and CDN, use Cloudflare in front for caching and passive failover, but true multi-region Cloud Run failover isn’t fully possible. If multi-region failover is top priority and you can skip Firebase Hosting, use Google Cloud Load Balancer directly to route traffic to Cloud Run. Use Full (strict) SSL with Cloudflare.