s3 源存储桶子目录中的 Cloudfront 默认根对象

Cloudfront Default Root Objects within Sub-directories of an s3 Origin Bucket

使用 AWS Cloudfront 可以 to specify a Default Root Object:

When you define a default root object, an end-user request that calls the root of your distribution returns the default root object. For example, if you designate the file index.html as your default root object, a request for:

http://d111111abcdef8.cloudfront.net/

Returns:

http://d111111abcdef8.cloudfront.net/index.html

如果 Cloudfront 托管 an S3 origin bucket 那么是否可以为每个子目录指定一个默认的根对象?

以访问子资源为例

http://d111111abcdef8.cloudfront.net/subresource

实际上 return

http://d111111abcdef8.cloudfront.net/subresource/index.html

提前感谢您的考虑和回复。

是的,在 Lambda@Edge 的帮助下是可能的。

https://aws.amazon.com/blogs/compute/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-lambdaedge/