力CloudFront的分布/文件更新文件、CloudFront

2023-09-11 10:15:06 作者:轉身〞從此絔鏴

我使用的是亚马逊的CloudFront的服务于我的Web应用程序的静态文件。

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

请问有没有办法告诉它需要刷新的文件或指出,应刷新单个文件CloudFront的分布?

Is there no way to tell a cloudfront distribution that it needs to refresh it's file or point out a single file that should be refreshed?

亚马逊建议您版本的文件,如logo_1.gif,logo_2.gif等为解决这一问题,但似乎像pretty的愚蠢的解决方案。有绝对没有其他办法吗?

Amazon recommend that you version your files like logo_1.gif, logo_2.gif and so on as a workaround for this problem but that seems like a pretty stupid solution. Is there absolutely no other way?

推荐答案

好消息。亚马逊终于增加了一个失效功能。 See该参考。

Good news. Amazon finally added an Invalidation Feature. See the API Reference.

这是由API参考的示例请求:

This is a sample request from the API Reference:

POST /2010-08-01/distribution/[distribution ID]/invalidation HTTP/1.0
Host: cloudfront.amazonaws.com
Authorization: [AWS authentication string]
Content-Type: text/xml

<InvalidationBatch>
   <Path>/image1.jpg</Path>
   <Path>/image2.jpg</Path>
   <Path>/videos/movie.flv</Path>
   <CallerReference>my-batch</CallerReference>
</InvalidationBatch>
 
精彩推荐
图片推荐