1

Use case: we have client that can download pictures from the S3 storage using pre-signed URL and periodically refresh them. We don't need to download the picture again if it has not changed. Problem: Can we use ETag and if-none-matchheader for solve our problem if pictures URL can change(e.g. after pre-signed URL expiration)?

mechanikos
  • 771
  • 12
  • 32
  • Possible duplicate of https://stackoverflow.com/questions/3026823/caching-images-with-different-query-strings-s3-signed-urls – user818510 May 30 '17 at 16:31
  • You can't do anything with an expired pre-signed URL... it's expired, and the service will immediately reject it on that basis, *before* anything else about the URL or the object is checked... so it isn't clear what you are trying to accomplish, or what you have tried. – Michael - sqlbot May 31 '17 at 00:28
  • I mean that same object can have different signed url-s and i don't know can i use ETag for caching – mechanikos May 31 '17 at 01:46

1 Answers1

1

We succesfully tested using Etag with S3 Pre-signed URL. You can send Etag with if-none-match header in Pre-signed URL and receive 304 not modified if content is identical. It will works regardless of URL, e.g.

  1. You get URL that expires after 10 minutes and use it for download image.
  2. Then you save Etag of this image
  3. An hour later, when the first URL expires, you get a second URL to check whether the image has changed
  4. Now you send saved Etag in header with second URL
mechanikos
  • 771
  • 12
  • 32