Amazon S3 and Cloudfront cache, how to clear cache

2019-03-08 21:59发布

I have a cron job that runs every 10 minutes and updates the content-type and x-amz-meta. But since yesterday it seems like after the cron job run, Amazon is not picking up the changes made (refreshing his cache).

I even went and made the changes manually but no change...

When a video is uploaded it has a application/x-mp4 content-type and the cron job changes it to video/mp4.

Although S3 has the right content type video/mp4 cloudfront shows application/x-mp4(old content-type) ....

The cron job has been working for the last 6 months without a problem.

What is wrong with amazon caching? How can i synchronize the caching?

8条回答
孤傲高冷的网名
2楼-- · 2019-03-08 22:52

Don't use invalidations. They cannot be reverted and you will be charged. They only way it works for me is reducing the TTL and wait.

Regards

查看更多
【Aperson】
3楼-- · 2019-03-08 22:56

S3 is not used for real time development but if you really want to test your freshly deployed website use

http://yourdomain.com/index.html?v=2
http://yourdomain.com/init.js?v=2

Adding a version parameter in the end will invalidate the cached version of the file and the browser will get a fresh copy of the file from the server bucket

查看更多
登录 后发表回答