Home > other >  How to prevent hotlinking S3? I set the rules, but the uploaded file is all, still have to manually
How to prevent hotlinking S3? I set the rules, but the uploaded file is all, still have to manually

Time:09-20

How to prevent hotlinking S3? I set the rules, but the uploaded file is all, still have to manually remove all visible?

CodePudding user response:

You can try the following bucket strategy

Readonly directory full readable
Refereronly limit referer domain name

 
{
"Version" : "2012-10-17,"
"The Statement:" [
{
Sid: "everyone can read the file",
"Effect" : "Allow",
"Principal" : "*",
"Action" : "s3: GetObject,"
"Resource", "arn: aws: s3: : : testpolicy readonly/* '
},
{
Sid: "Allow the get requests referred by www.example.com and example.com",
"Effect" : "Allow",
"Principal" : "*",
"Action" : "s3: GetObject,"
"Resource", "arn: aws: s3: : : testpolicy refereronly/*",
"Condition" : {
"StringLike" : {
"Aws: Referer" :
"Http://www.example.com/*,"
"Http://example.com/*
"]
}
}
}
]
}


Reference: https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/dev/example-bucket-policies.html

CodePudding user response:

Set, seem to have no use
  •  Tags:  
  • AWS
  • Related