Amazon web services 如何使用Bucket策略AWS S3防止图像热链接

Amazon web services 如何使用Bucket策略AWS S3防止图像热链接,amazon-web-services,amazon-s3,bucket,hotlinking,Amazon Web Services,Amazon S3,Bucket,Hotlinking,我试图阻止S3存储桶中的图像热链接。我原以为这会奏效,但到目前为止运气不佳: { "Version": "2008-10-17", "Id": "Bucket policy for example.com", "Statement": [ { "Sid": "Allow GET requests referred by example.com", "Effect": "Allow",

我试图阻止S3存储桶中的图像热链接。我原以为这会奏效,但到目前为止运气不佳:

{
    "Version": "2008-10-17",
    "Id": "Bucket policy for example.com",
    "Statement": [
        {
            "Sid": "Allow GET requests referred by example.com",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::example/*",
            "Condition": {
                "StringLike": {
                    "aws:Referer": [
                        "https://www.example.com/*",
                        "http://www.example.com/*",
                        "https://example.com/*",
                        "http://example.com/*"
                    ]
                }
            }
        },
        {
            "Sid": "Allow GET requests that don't specify a referrer",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::example/*",
            "Condition": {
                "Null": {
                    "aws:Referer": true
                }
            }
        }
    ]
}

如何使此策略拒绝访问其他网站上嵌入的图像?

我的个人权限设置为,everyone:read access-这可能是问题所在吗?如果设置了公共文件,则可能没有什么可拒绝的。尝试在您的策略中从“允许”更改为“拒绝”,从“StringLike”更改为“StringNotLike”。是的,您刚刚发现:D