Akshay Srivastava
Akshay Srivastava

Reputation: 25

Amazon Cloudfront cache issue

Hey I have started using Cloudfront. In my application I have images in s3 bucket. User can update these images .When user update the image ,image get created in the s3bucket and replaces the older image with the new image .After the image get still the older image get dispalyed to user as for GET operations I am using Cloudfront so the older image is retrieved from the cloudfront cache.

So is there any technique to resolve this ...

Upvotes: 1

Views: 1728

Answers (2)

Vladimir Mukhin
Vladimir Mukhin

Reputation: 565

You can resolve your issue by setting up your cache TTL to 0. Go to "AWS Dashboard | S3 | Your bucket | Your file | Edit Properties | Metadata". There set your "Cache-Control" value to "max-age=0".

More information here: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html

Upvotes: 1

Mark B
Mark B

Reputation: 201058

As is the case with pretty much every CDN, you have to invalidate the cache to get the CDN to start serving the new version. http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

I would suggest reading all the content at that link under the "Adding, Removing, or Replacing Objects in a Distribution" section. Actually I would suggest reading all the CloudFront documentation so that you can understand how the service you are using works.

Upvotes: 1

Related Questions