0

I searched all over and found a method to cache images on Amazon S3. Whenever I upload an image, I add a meta element of cache-control and then set max-age=86400. However, on any sort of speed test site it says that my images do not have a cache applied to them.

I am not sure if it matters, but I have CloudFront linked to this S3 bucket. Sorry, but completely new to AWS.

Anyone know why my images may not be caching?

enter image description here

enter image description hereenter image description here

Paul
  • 3,238
  • 3
  • 27
  • 64
  • Could be the content-type? I see image/jpeg in your settings screenshot, but URLs pasted in below screenshot are .jpg – kosa May 09 '17 at 14:04
  • @Nambari There isn't an option for image/jpg in the meta `content-type`. The only ones listed are within the image I just added to my question. – Paul May 09 '17 at 14:48
  • Just to validate caching is really working or not, may be you can quickly add one of the jpeg (or) png version of your image and test it? If it works, ultimately you might need to change all your JPG images to jpeg (or) png – kosa May 09 '17 at 14:51
  • @Nambari The image `cross-gray` is a png and the `content-type` for this image is `image.png` in S3, but as you can see in my speed test above, the image is displaying as not caching. – Paul May 09 '17 at 14:58

1 Answers1

2

on any sort of speed test site it says that my images do not have a cache applied to them.

That isn't what this says. The screenshot says they have a short freshness lifetime, and longer than 1 week is recommended.

Your setting of max-age=86400 is only 24 hours.

Michael - sqlbot
  • 154,904
  • 21
  • 299
  • 378