简体   繁体   中英

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 ...

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM