简体   繁体   English

CloudFront是否支持版本化来源?

[英]Does CloudFront support versioned origins?

I have a versioned S3 bucket as my origin. 我有一个版本为S3的存储桶作为源。 Is this the correct format for accessing a specific version of an object from CloudFront? 这是用于从CloudFront访问对象的特定版本的正确格式吗?

http://example.cloudfront.net/files/file.pdf?verisonId=[id] http://example.cloudfront.net/files/file.pdf?verisonId=[id]

It is ignoring versionId and always serving the head object. 它会忽略versionId并始终为head对象服务。

My S3 Bucket Policy allows the following actions for CloudFront: 我的S3存储桶策略允许CloudFront执行以下操作:

s3:GetObjectVersion

s3:GetObject

I've searched and searched but can't seem to find any documentation on this. 我进行了搜索,但似乎找不到任何文档。 How do I specify a versionId in a CloudFront URL? 如何在CloudFront URL中指定versionId?

I figured this out. 我想通了。 In CloudFront go to Distributions > Behaviors. 在CloudFront中,转到“分布”>“行为”。 Set "Forward Query Strings" to Yes. 将“转发查询字符串”设置为“是”。 This will allow CloudFront to pass versionId to S3 and cache the correct version. 这将使CloudFront可以将versionId传递给S3并缓存正确的版本。

Note that you also only need the s3:GetObject bucket policy action to make this work. 请注意,您还只需要s3:GetObject存储桶策略操作即可执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM