1

We will use Google Cloud CDN to cache the objects in the backend bucket as follows.

$ gcloud compute backend-buckets describe xxx-backend-bucket
bucketName: xxx
cdnPolicy:
  cacheMode: CACHE_ALL_STATIC
  clientTtl: 0
  defaultTtl: 60
  maxTtl: 60
  negativeCaching: false
  requestCoalescing: true
  serveWhileStale: 300
description: ''
enableCdn: true
kind: compute#backendBucket
name: xxx-backend-bucket

The metadata of the bucket object is set to cache-control: max-age=31536000.

On the first request from the client, the CDN will return a 200 response and override the cache-control with max-age=0. This is the expected behavior.

However, if there is an if-modified-since in the request header from the client, the CDN will return a 304 response and the cache-control in the response header will be set to max-age=31536000. The expected behavior is to set max-age=0.

I'm having trouble with 304 responses because the cache-control is not overridden and is cached by the client for an unintentionally long time.

Is this a CDN specification?

ryosuke
  • 11
  • 2
  • I would suggest you file a [Private Cloud CDN issue](https://b.corp.google.com/issues/new?component=491342&template=1160995) on the [Google issue trackers](https://cloud.google.com/support/docs/issue-trackers) so that GCP Support can take a closer look. – Tariq Jul 14 '21 at 15:19
  • @Tariq Thanks for the advice, I created an issue in IssueTracker. https://issuetracker.google.com/issues/193686622 – ryosuke Jul 15 '21 at 07:05
  • This issue has been resolved. – ryosuke Oct 06 '21 at 10:35

0 Answers0