可以通过在分配给Cloudfront的S3桶的对象键上指定前缀和分隔符来解决这个问题。示例代码如下:
以分隔符"-"分割S3对象键,然后在Cloudfront分发中使用前缀"images/":
S3对象键:images/picture-01.jpg
Cloudfront链接:https://d111111abcdef8.cloudfront.net/images/picture-01.jpg
以分隔符"-"分割S3对象键,并在Cloudfront分发中使用前缀"thumbnails/":
S3对象键:images/picture-01.jpg
S3对象键:thumbnails/picture-01.jpg
Cloudfront链接:https://d111111abcdef8.cloudfront.net/thumbnails/picture-01.jpg
注意:前缀和分隔符参数仅在指定的情况下才生效。在上述示例中,S3对象键必须以指定的前缀和分隔符开头才能在Cloudfront分配中使用。