How do I prevent hotlinking on Amazon S3 without using signed URLs?

后端 未结 7 746
误落风尘
误落风尘 2020-12-24 02:36

Is there any way I can prevent hotlinking on Amazon S3 without using signed URLs?

7条回答
  •  Happy的楠姐
    2020-12-24 03:19

    It's in their official docs

    Change examplebucket to your bucket name, and example.com to your domain.

    "Version":"2012-10-17",
    "Id":"http referer policy example",
    "Statement":[
      {
        "Sid":"Allow get requests originating from www.example.com and example.com.",
        "Effect":"Allow",
        "Principal":"*",
        "Action":"s3:GetObject",
        "Resource":"arn:aws:s3:::examplebucket/*",
        "Condition":{
          "StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
        }
      }
    ]
    }
    

提交回复
热议问题