2

I want to put a CDN in front of a Google Cloud Run service in order to cache some responses.

Right now it seems Cloud CDN requires a Google Load Balancer, and they cannot point to a Google Cloud Run service (https://github.com/ahmetb/cloud-run-faq/tree/e7a0fc43d3054456613c09e073db289ddf76dd33#how-can-i-configure-cdn-for-cloud-run-services).

Is there another way?

HectorJ
  • 5,814
  • 3
  • 34
  • 52
  • I thought I could do it via a Internet Network Endpoint Group pointing to the `[...].run.app` domain, but it's a dead-end. – HectorJ Feb 15 '20 at 21:52
  • 2
    This *is* coming in the medium term - both HTTPS Balancing & Cloud CDN will be able to front Cloud Run. See https://twitter.com/ahmetb/status/1227653149835448320 for an example! If you have an account team, please reach out to them. – elithrar Feb 16 '20 at 00:51

2 Answers2

4

[updated]

You can use Cloud CDN with Cloud Run via Google Cloud Load Balancer

Steren
  • 7,311
  • 3
  • 31
  • 51
  • Available through load balancing since 2020-07-07: https://cloud.google.com/load-balancing/docs/release-notes#July_07_2020 . As reflected in https://cloud.google.com/run/docs/using-gcp-services#connect-trigger – HectorJ Sep 23 '20 at 07:41
1

Additionally it's possible without using the Load Balancer by serving it through a Firebase app by adding a Cache-Control header and via a rewrite rule in firebase.json (via the unofficial Cloud Run FAQ).

jimmont
  • 2,304
  • 1
  • 27
  • 29