digital ocean spaces防盗链策略(s3储存防盗链教程)

发布于 2022-08-04  71 次阅读


xdaza前言

虽然市面上有很多亚马逊S3防盗链教程,但是关于digital ocean spaces的相关教程却寥寥无几(虽然本质上它俩就一样)


🪩S3浏览器防盗链策略

{
"Version": "2008-10-17",
"Id": "preventHotLinking",
"Statement": [
{
"Sid": "Allow in my domains",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket name/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"https://yourdomain.com/*"
]
}
}
},
{
"Sid": "Deny access if referer is not my sites",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket name/*",
"Condition": {
"StringNotLike": {
"aws:Referer": [
"https://yourdomain.com/*"
]
}
}
}
]
}

但是还有个问题,这样在S3浏览器里设置之后,只对原点地址有效,对cdn的子域名却无效,do的客服也没有解决方案,暂时不知道怎么解决


叽里咕噜~叽里咕噜~我又要去打杂啦づ ̄3 ̄)づ╭❤~