查找indes.html/img.png中图像的AWS S3重定向规则



background:当我将静态网站与salesforce集成时,发生了一个问题,它在s3桶地址中查找我的索引文件,但它在index.html下的位置查找其图像喜欢的东西:/index.html/img.png而图像实际上位于与index.html文件本身相同的文件夹

我看到在桶属性中有重定向规则(在"编辑静态网站托管"部分),是否有一些方法使每次调用检索这样的图像,以寻找它在正确的位置?

我尝试了以下语法:

[
{
"Condition": {
"KeyPrefixEquals": "index.html/icon.png"
},
"Redirect": {
"ReplaceKeyPrefixWith": "icon.png"
}
},
{
"Condition": {
"KeyPrefixEquals": "index.html/dragIcon.png"
},
"Redirect": {
"ReplaceKeyPrefixWith": "dragIcon.png"
}
}
]

但是由于某些原因它不工作

替换KeyPrefix可能不是你想要做的,示例应该重定向index.html/icon.png ->程序/程序和index.html/dragIcon.png ->dragIcon.png/dragIcon.png

如果您将重定向更改为"ReplaceKeyWith": ....而不是"ReplaceKeyPrefixWith":
它应该按您期望的方式工作。

最新更新