强制 CloudFront 分发/文件更新 [英] Force CloudFront distribution/file update

查看:28
本文介绍了强制 CloudFront 分发/文件更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Amazon 的 CloudFront 来提供我的网络应用程序的静态文件.

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 等,作为解决此问题的方法,但这似乎是一个非常愚蠢的解决方案.就没有别的办法了吗?

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?

推荐答案

好消息.亚马逊终于添加了一个无效功能.请参阅 API 参考.

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 分发/文件更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆