相关疑难解决方法(0)

基于引用来限制对AWS S3存储桶的访问

我正在尝试限制对S3存储桶的访问,并且只允许基于引用者的列表中的某些域.

存储桶策略基本上是:

{
"Version": "2012-10-17",
"Id": "http referer domain lock",
"Statement": [
    {
        "Sid": "Allow get requests originating from specific domains",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::example.com/*",
        "Condition": {
            "StringLike": {
                "aws:Referer":  [ 
                    "*othersite1.com/*",
                    "*othersite2.com/*",
                    "*othersite3.com/*"
                ]
            }
        }
    }
 ]
}
Run Code Online (Sandbox Code Playgroud)

这个otherite1,2和3调用一个对象,我已经存储在域example.com下的s3存储桶中.我还有一个附加到存储桶的云端分发.我在字符串条件之前和之后使用*通配符.引用者可以是othersite1.com/folder/another-folder/page.html.引用者也可以使用http或https.

我不知道为什么我得到403 Forbidden错误.

我这样做基本上是因为我不希望其他网站调用该对象.

任何帮助将不胜感激.

policy amazon-s3 amazon-web-services amazon-cloudfront

1
推荐指数
1
解决办法
1468
查看次数