Skip to main content
sitewarm
Rank 9 of 10 on caching criteria

Google Cloud CDN caching guide

Google Cloud · reviewed against the vendor documentation listed below

How Google Cloud CDN caches: cache modes, CDN-Cache-Control, a custom cache-status header, invalidation by path or tag, and when to use Media CDN.

Part of the Top 10 CDNs in 2026 comparison. New to the topic? Start with why cache warming matters.

Caching at a glance

Cache status on the response
No cache-status header by default. Add a custom response header with the {cdn_cache_status} variable, or read httpRequest.cacheHit and jsonPayload.statusDetails (for example response_from_cache) in the logs. Cached responses carry an Age header above 0.
TTL controls
Cache modes CACHE_ALL_STATIC (the default for gcloud and the API), USE_ORIGIN_HEADERS and FORCE_CACHE_ALL. CDN-Cache-Control is honored ahead of Cache-Control.
Purge
Invalidation by path (with wildcards such as /images/*), by host, or by cache tag (Cache-Tag header). Invalidation removes content; the next request goes to the origin.
Tiering and origin protection
Request coalescing is listed as a feature. A tiered or shield layer is not described in the pages we reviewed. Cloud CDN works with the global external Application Load Balancer and the classic Application Load Balancer.
Edge compute
Not part of Cloud CDN; Media CDN is the separate product for streaming and large files.

Strengths for caching

  • stale-while-revalidate is served while the cache revalidates asynchronously, and Serve While Stale (24 hours by default) answers from cache when the origin is unreachable.
  • CDN-Cache-Control support for a CDN-only TTL.
  • Cache tag invalidation alongside path and host invalidation.

Watch-outs

  • Cache state is not on the response unless you add a custom header.
  • The stale-if-error response directive has no effect; Serve While Stale covers that case instead.
  • In the default CACHE_ALL_STATIC mode, dynamic HTML without caching headers is not cached.

Cache warming on Google Cloud

Before warming on Google Cloud CDN, make the result visible: add a custom response header set to {cdn_cache_status} on the backend service or bucket. Otherwise the only signal on the response is an Age header above 0 on cached responses, and the full answer is in the logs.

Then check the cache mode. In CACHE_ALL_STATIC, HTML pages are cached only if the origin marks them cacheable, so warming needs Cache-Control or CDN-Cache-Control with a TTL on those pages, or FORCE_CACHE_ALL for content that is never personalized.

gcloud compute backend-services update web-backend --global \
  --custom-response-header='Cdn-Cache-Status: {cdn_cache_status}'
curl -sI https://example.com/ | grep -iE '^(cdn-cache-status|age)'

After an invalidation, the next request for each path goes to the origin, so warm the invalidated paths right away. The Top 10 CDNs comparison covers how this was scored.

Frequently asked questions

How do I see whether Google Cloud CDN served a response from cache?

Add a custom response header with the {cdn_cache_status} variable, or check httpRequest.cacheHit in the logs. Cached responses also carry an Age header above 0.

Should I use Cloud CDN or Media CDN?

Media CDN is Google's product for streaming and large file downloads. Cloud CDN is the one that sits behind an Application Load Balancer for websites and APIs.

Google Cloud documentation

  1. Cloud CDN: Caching overviewhttps://docs.cloud.google.com/cdn/docs/caching
  2. Cloud CDN: Using cache modeshttps://docs.cloud.google.com/cdn/docs/using-cache-modes
  3. Cloud CDN: Logging and monitoringhttps://docs.cloud.google.com/cdn/docs/logging
  4. Cloud CDN: Invalidating cached contenthttps://docs.cloud.google.com/cdn/docs/invalidating-cached-content
  5. Cloud CDN: Overviewhttps://docs.cloud.google.com/cdn/docs/overview
  6. Media CDN: Overviewhttps://docs.cloud.google.com/media-cdn/docs/overview

Warm your cache after every deploy

sitewarm requests the pages in your sitemap after a deploy and reports the cache state the CDN returns for each one, with the vantage point it was measured from.