我有一个CDN和2个存储桶
一个存储桶正在使用默认行为,因此可以通过CDN URL img.png
cdn.com/img.png
一个存储桶正在使用/path
行为,因此CDN中路由到/ path的所有内容都应进入该存储桶。当我将其放在存储桶中时,它会起作用:path/test.png
。我可以访问cdn.com/path/test.png
。
我想要的是将test.png
放在我的存储桶的根中,而没有前缀path/
。这可能(不使用lambda @ edge)吗?
答案 0 :(得分:0)
如果要重写路径,则必须使用lambda @ edge。
如果可以使用301重定向,则可以尝试在S3存储桶和use the following redirection rule上启用静态网站托管:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>path/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith/>
</Redirect>
</RoutingRule>
</RoutingRules>