I'm using AWS CloudFront linked to an S3 bucket to host a static (React) website. Everything seems to work ok except when I upload altered files to the bucket. I know that by design CloudFront will cache files, and you have to invalidate changed files for CloudFront to pick up new changes asap. However, whenever I browse to the website (on different devices), I will get older versions of the files still. Sometimes, I will see the latest versions of the webpage but then later when I browse to the same page, it gets an old version (even after clearing the cache or browsing in Incognito)?! Very strange.
I have some questions regarding my set up:
Would appreciate some feedback on this as I'm new to AWS and there's so many configurable elements it does seem daunting at times!
Thanks
Does adding a cache-control value on all files affect the invalidation?
Yes, that's your issue.
If you're adding cache-control on files, they are being cached on the client (browser), and an invalidation in Cloudfront will not remove those files from a client's cache.
You have several options:
Yeah really Caching kills but in AWS you have a solution for that....
1. AWS Cloud front
2. In that Click the ID you want
3. You can able to see the Invalidations tab, click that
4. Then Create Invalidation
5. Enter -> /* and click Invalidate
After Invalidation done, You can able to see your latest changes
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.