从 CDN 缓存中删除文件

Remove file from CDN cache

我已经在 s3 存储桶中上传了一个文件,并且还为加载文件添加了 CDN 缓存。我想用相同的名称更新它,但问题是我无法获取更新的文件。 CDN return 始终是旧文件,因为它在 CDN 中缓存了 1 年(max-age:31536000)。

那么,我怎样才能将它从 CDN 中删除?

您可以按照 https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html 中的说明使文件无效。失效指示 CloudFront 忽略其缓存中的副本,而是联系原始服务器。