AWS cloudfront not updating on update of files in S3

后端 未结 9 510
无人共我
无人共我 2021-02-01 14:12

I created a distribution in cloudfront using my files on S3. It worked fine and all my files were available. But today I updated my files on S3 and tried to access them via Clou

相关标签:
9条回答
  • 2021-02-01 14:52

    Thanks tedder42 and Chris Heald

    I was able to reduce the cache duration in my origin i.e. s3 object and deliver the files more instantly then what it was by default 24 hours. for some of my other distribution I also set forward all headers to origin in which cloudfront doesn't cache anything and sends all request to origin.

    thanks.

    0 讨论(0)
  • 2021-02-01 14:59

    I also had this issue and solved it by using versioning (not the same as S3 versioning). Here is a comprehensive link to using versioning with cloudfront

    Invalidating Files In summary:

    When you upload a new file or files to your S3 bucket, change the version, and update your links as appropriate. From the documentation the benefit of using versioning vs. invalidating (the other way to do this) is that there is no additional charge for making CloudFront refresh by version changes whereas there is with invalidation. If you have hundreds of files this may be problematic, but its possible that by adding a version to your root directory, or default root object (if applicable) it wouldn't be a problem. In my case, I have an SPA, all I have to do is change the version of my default root object (index.html to index2.html) and it instantly updates on CloudFront.

    0 讨论(0)
  • 2021-02-01 15:02

    Please refer to this answer this may help you.

    What's the difference between Cache-Control: max-age=0 and no-cache?

    Adding a variable Cache-Control to 0 in the header to the selected file in S3

    0 讨论(0)
提交回复
热议问题