AWS 对象失效 - / 如何确定图像是否从 Edge 中删除
AWS object invalidation- / How to be Sure If Image removed from Edge
它说我们可以使用通配符
假设我们有这样的路径
https://cdn_url/rootimage/first/1/type/1.png
https://cdn_url/rootimage/first/1/type/2.png
https://cdn_url/rootimage/first/2/type/1.png
https://cdn_url/rootimage/first/2/type/2.png
https://cdn_url/rootimage/second/1/type/1.png
https://cdn_url/rootimage/second/1/type/2.png
https://cdn_url/rootimage/second/2/type/1.png
https://cdn_url/rootimage/second/1/type/2.png
所以如果我写
AmazonCloudFrontClient objClient = new AmazonCloudFrontClient(ConfigurationManager.AppSettings["s3accesskey"], ConfigurationManager.AppSettings["s3secret"]);
objClient.CreateInvalidation(new CreateInvalidationRequest
{
DistributionId = ConfigurationManager.AppSettings["CDNDistributionId"],
InvalidationBatch = new InvalidationBatch
{
Paths = new Paths { Items = "/cdn_url/rootimage/*", Quantity = 1 }
}
});
上面的代码行得通吗?
Quantity 是 1 还是所有实际图像的数量。
如何验证失效是否完成。
我也在门户网站上手动尝试过,几分钟后我看到它说失效已完成,我如何确定是否从 Edge 中删除了图像。
谢谢
失效路径需要相对于 CloudFront URL 中用于访问您想要失效的内容的路径——而不是相对于后端(原始服务器)URL/path。
要使分发中的所有内容(即从根开始的所有内容)无效,指定的正确路径很简单 *
。使用 /*
也可以。
经过大量挖掘看来,
图片Header响应可以使用
Connection
keep-alive
Date
Mon, 15 Feb 2016 09:54:40 GMT
Etag
"8239143f88d513feb78b025c5d4e1da7"
Last-Modified
Fri, 12 Feb 2016 05:32:30 GMT
Server
AmazonS3
Via
1.1 cldfrontUrl.ddfds (CloudFront)
X-Amz-Cf-Id
NKGtNTaLYGepIJ9Vjc1xgtQGn4AuhukYutQBDtSRPIyTGBDwLcxXgA==
X-Cache
Miss from cloudfront
所以如果是
Miss from cloudfront // Object is not in edge..
和
Hit from cloudfront //Object is in edge..
它说我们可以使用通配符
假设我们有这样的路径
https://cdn_url/rootimage/first/1/type/1.png
https://cdn_url/rootimage/first/1/type/2.png
https://cdn_url/rootimage/first/2/type/1.png
https://cdn_url/rootimage/first/2/type/2.png
https://cdn_url/rootimage/second/1/type/1.png
https://cdn_url/rootimage/second/1/type/2.png
https://cdn_url/rootimage/second/2/type/1.png
https://cdn_url/rootimage/second/1/type/2.png
所以如果我写
AmazonCloudFrontClient objClient = new AmazonCloudFrontClient(ConfigurationManager.AppSettings["s3accesskey"], ConfigurationManager.AppSettings["s3secret"]);
objClient.CreateInvalidation(new CreateInvalidationRequest
{
DistributionId = ConfigurationManager.AppSettings["CDNDistributionId"],
InvalidationBatch = new InvalidationBatch
{
Paths = new Paths { Items = "/cdn_url/rootimage/*", Quantity = 1 }
}
});
上面的代码行得通吗? Quantity 是 1 还是所有实际图像的数量。
如何验证失效是否完成。
我也在门户网站上手动尝试过,几分钟后我看到它说失效已完成,我如何确定是否从 Edge 中删除了图像。
谢谢
失效路径需要相对于 CloudFront URL 中用于访问您想要失效的内容的路径——而不是相对于后端(原始服务器)URL/path。
要使分发中的所有内容(即从根开始的所有内容)无效,指定的正确路径很简单 *
。使用 /*
也可以。
经过大量挖掘看来,
图片Header响应可以使用
Connection
keep-alive Date
Mon, 15 Feb 2016 09:54:40 GMT Etag
"8239143f88d513feb78b025c5d4e1da7" Last-Modified
Fri, 12 Feb 2016 05:32:30 GMT Server
AmazonS3 Via 1.1 cldfrontUrl.ddfds (CloudFront) X-Amz-Cf-Id NKGtNTaLYGepIJ9Vjc1xgtQGn4AuhukYutQBDtSRPIyTGBDwLcxXgA== X-Cache Miss from cloudfront
所以如果是
Miss from cloudfront // Object is not in edge..
和
Hit from cloudfront //Object is in edge..