2
votes

I have some images in Google Cloud Storage that I want to cache through the standard browser cache. So, in file object metadata field I wrote:

Cache-control : public, max-age=300, no-transform.

But when I get the image by generated URL the cache header reads:

cache-control: no-cache, no-store, max-age=0, must-revalidate.

Why does it happen and how can I fix it?

Headers from browser screenshot

Metadata form in Google Cloud Storage screenshot

2

2 Answers

0
votes

Only objects that are public can be cached as also stated in the documentation:

Cache-Control only applies to objects with a public-read ACL. Non-public data are not cacheable.

You are able to set the Cache-Control metadata even if the object is not public, but it will have no effect.

0
votes

Ok, I solve the problem. Google object has 2 links for access. The correct link you may see on the screenshot. Previously, I use the link on "link URL" section.

Difference between two links it is a request server:

I confused, but I don't observe little link button, so close to the big "link URL".

correct url screenshot