amazon s3
使用技巧
防盗链方法
在 Bucket policy 设置中设置
说明:
arn:aws:s3:::img.yeniugo.com/*
中的 img.yeniugo.com
为 bucket
名称aws:Referer
里面的值为支持的网址{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow get requests originating from www.example.com and example.com.",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::img.yeniugo.com/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"https://*.yeniugo.com/*",
"https://yeniugo.com/*"
]
}
}
}
]
}
cors设置
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://*.yeniugo.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
评论
发表评论