aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

Allow response-cache-control header in S3 headObject

Open Digized opened this issue 2 years ago • 2 comments

Confirm by changing [ ] to [x] below:

  • [X] This is a feature with version 2.x of the SDK

Is your feature request related to a problem? Please describe. I am using Last-Modified as an optimistic concurrency mechanism. I am calling the headObject api every ~2s. Although this works as expected on Chrome, Firefox caches this result, and responds with an old time when headObject is invoked again.

Describe the solution you'd like I would like to be able to specify Cache-Control as no-cache for my request for all the browsers to behave the same.

The getObject has a response-cache-control header that can be provided to achieve this result and I would prefer if that was added to the headObject api as well. https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html#API_GetObject_RequestSyntax

Describe alternatives you've considered The alternative is that I set metadata of each s3 object as cache-control: no-cache, which works fine for newly created objects. but unfortunately we already have objects in customer accounts that do not have this metadata set, and we will now require additional permissions i.e CopyObject from the customer.

Digized avatar Apr 26 '22 15:04 Digized

The headObject request docs from S3 does not document response-cache-control header.

trivikr avatar Apr 26 '22 17:04 trivikr

I wasn't able to repro this since it seems to pass cache-control: max-age=0 in the request headers

https://github.com/Digized/aws-sdk-js-tests

internal ticket V569765586

internal diff ar3iq57k

Digized avatar Apr 26 '22 20:04 Digized

Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.

github-actions[bot] avatar Apr 27 '23 00:04 github-actions[bot]