问题描述
我使用的是亚马逊的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?
推荐答案
好消息。亚马逊终于增加了一个失效功能。 <一href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?Actions_Invalidations.html">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>
这篇关于力CloudFront的分布/文件更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!