object metadata (cache control) being deleted whenever new version uploaded?

38 Views Asked by At

Just what it says. I have objects in a bucket that is fully public. I have set the cache control metadata on each one to something (e.g. "public, max-age=60", or "no-store"). Whatever I set it to, it saves fine. However, as soon as I upload a new version of the file, it deletes the metadata. I have tried with object versioning on and off. What am I doing wrong?

1

There are 1 best solutions below

1
Chanpols On

As mentioned by @John Hanley:

The new version replaces the live version and receives a new generation number. The old live version becomes a noncurrent version and keeps the same generation number.

You can edit the value of the Cache-Control metadata at any time, but you can only assign the storageClass metadata when the object is created or rewritten, and you cannot directly edit the value for the generation metadata, though the generation value changes when the object is replaced.

Reference: