Force CloudFront distribution/file update

后端 未结 13 1215
失恋的感觉
失恋的感觉 2020-12-07 07:01

I\'m using Amazon\'s CloudFront to serve static files of my web apps.

Is there no way to tell a cloudfront distribution that it needs to refresh it\'s file or point

13条回答
  •  Happy的楠姐
    2020-12-07 07:43

    As of March 19, Amazon now allows Cloudfront's cache TTL to be 0 seconds, thus you (theoretically) should never see stale objects. So if you have your assets in S3, you could simply go to AWS Web Panel => S3 => Edit Properties => Metadata, then set your "Cache-Control" value to "max-age=0".

    This is straight from the API documentation:

    To control whether CloudFront caches an object and for how long, we recommend that you use the Cache-Control header with the max-age= directive. CloudFront caches the object for the specified number of seconds. (The minimum value is 0 seconds.)

提交回复
热议问题