Cloud CDN not caching: cache misses because of Set-Cookie, Cache-Control or missing cache mode
Responses keep missing the CDN cache, so every request reaches the origin.
Cloud CDN cache missCloud CDN not caching responsescacheStatus MISS Cloud CDNcache hit ratio low Cloud CDNCloud CDN cache-mode FORCE_CACHE_ALL Meaning
Cloud CDN only caches cacheable responses: no Set-Cookie, no Cache-Control: private/no-store, appropriate status codes, and a cache mode that allows it (CACHE_ALL_STATIC/FORCE_CACHE_ALL). Check the Age header and cacheStatus in logs, and the cache key (cookies/headers/query strings).
Common causes
Set-Cookieon the responseCache-Control: privateorno-store- Cache mode USE_ORIGIN_HEADERS without headers
- Cache key includes varying parameters
- Response status not cacheable
⚡ Quick fix
- Remove Set-Cookie from cacheable responses
- Set
Cache-Control: public, max-age=3600or a cache mode override - Trim the cache key to needed parts
Detailed fix by platform
Shell
gcloud compute backend-services update BACKEND --global --enable-cdn --cache-mode=CACHE_ALL_STATIC
How to diagnose
- Set-Cookie — Present?
- Cache-Control — Public?
- Cache key — Minimal?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 502 Bad Gateway: failed_to_connect_to_backend Google Cloud Load Balancing: 502 Bad Gateway — jsonPayload.statusDetails: failed_to_connect_to_backend / backend_connection_closed_before_data_sent_to_client
- cache Firebase Hosting serves old files after deploy (CDN cache and Cache-Control headers)
- Cache-Control CDN not caching: Cache-Control private / no-cache / Set-Cookie on the response
Most viewed in Google Cloud / Firebase
- Missing or insufficient permissions Firestore: FirebaseError: [code=permission-denied]: Missing or insufficient permissions
- Container failed to start Cloud Run: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable
- 409: The resource already exists Compute Engine: ERROR: (gcloud.compute.instances.create) Could not fetch resource: The resource 'projects/p/zones/z/instances/vm-1' already exists
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026