0

I've set up Google Cloud CDN with a Storage Bucket as a backend and tested that my requests were being cached before deploying into production use.

I am now finding that only certain paths/objects are being cached. (Confirmation in Logs Viewer, latency difference in requests and presence of Age: header in the response.

After testing all morning I'm finding that there paths where all objects under that path are not being cache and paths where all objects under that path are being cached.

Permisions and Cache-Control: headers were set globally using gsutil command.

Any pointers from anyone with Cloud CDN experience would be appreciated.

Path that is being cached: http://assets.affcdn.net/1/rolling.gif

Path that is not being cached: http://assets.affcdn.net/v3/android.png

  • 1
    Hi, from a first look, it seems an internal header is somehow set on the second object that overrides the public cache-control and disables caching. The Cloud Storage team has reproduced the issue and is looking into it. – lot Jun 28 '17 at 22:20
  • Thanks for your response. Good to know it has been confirmed as a bug. I [filed a bug](https://issuetracker.google.com/issues/63056633) on Cloud CDN issue tracker not long after asking here, hopefully there'll be some resolution soon. – Guy Thouret Jun 30 '17 at 08:44
  • Did you update or otherwise modify the objects? I can no longer reproduce the issue, both URLs are being cached as expected now. – lot Jul 13 '17 at 06:47
  • Yes this issue was resolved, I've added the solution as the answer. – Guy Thouret Jul 14 '17 at 13:26

1 Answers1

3

This issue was resolved by editing the permissions of non caching files and granting read permission to 'allUsers' group.

This was not very well documented as the cache criteria only states that the files be shared publicly, which they had.

The GCP documentation Making Data Public had been followed previously and while this does make data public it does not make it cacheable as the allUsers permission is missing.

  • Can you clarify how that object was 'public', but didn't have 'allUsers' on it? It's not clear to me form the docs you linked to (nor from my knowledge of the system)... At the very least we'd like to clarify the docs around this – lot Jul 17 '17 at 23:09
  • 1
    It took me a while to work out what I had done here! In the documentation 'Making Data Public' I followed the instructions for 'Making Groups of Objects Publicly Readable' using the console. So that was adding allUsers to the bucket permissions with 'Storage Object Viewer' role. This makes the objects publicly accessible but does not allow them to be cached. To make the objects cacheable, I have to add the allUsers read permission to the individual objects. – Guy Thouret Jul 18 '17 at 10:11