title: Switch a live domain to Google Cloud Run without downtime
body: <p>I have Google Cloud Run set up on my custom cloud run domain, foo-eu7vrotrfq-uc.a.run.app.  I have a domain, foo.com, that is currently serving live traffic.  I want to start serving foo.com on Cloud Run without disruption to ~100 concurrent users.</p>
  
  <p>It seems like this is impossible with the current domain mapping feature.  Domain mapping requires that DNS is updated in order for the certificate to be issued.  According to <a href="https://cloud.google.com/run/docs/mapping-custom-domains" rel="noreferrer">the documentation</a>, this takes up to 15 minutes (took about 5 minutes in my test).  During these 15 minutes, foo.com will not serve correctly.</p>
  
  <p>Here are some ideas:</p>
  
  <ul>
  <li>Set up the certificate for cloudrun.foo.com and then CNAME foo.com to cloudrun.foo.com. --> Google returns an error presumably because the hostname is not recognized.</li>
  <li>If Domain Mapping doesn't check DNS records but just needs to expose the LetsEncrypt challenge, write a server that proxies the challenge to Cloud Run and all other traffic to the current web server.  --> This is a lot of work and is dependent on internal implementation details of the Domain Mapping feature.  I actually tried this using a Cloudflare Worker but looks like DNS change is required.</li>
  </ul>
  
  <p>Has anyone figured out a workaround for this problem?  It seems like there is no way to switch to Cloud Run for existing domains without incurring downtime.</p>