Question

How to set the Referer bucket policy in spaces?

Posted December 5, 2021 83 views
DigitalOcean

My digitalocean space bucket is located at singapore ( sgp1.digitaloceanspaces.com) and i have updated following policy to it. it applied successfully.

{
“Statement”: [
{
“Effect”: “Allow”,
“Principal”: “”,
“Action”: “s3:GetObject”,
“Resource”: [
“arn:aws:s3:::chathuranga”,
“arn:aws:s3:::chathuranga/
”,
]
“Condition”: {
“StringLike”: {
“aws:Referer”: [
http://chathuranga.com/*
]
}
}
}
]
}

command

s3cmd setpolicy policy.json s3://chathuranga

Expected behaviour

If i am accessing the content outside the chathuranga.com, it should deny.

Current behaviour

The content can be access from any domain.

Can anyone suggest what is wrong here? I have created the another bucket in nyc3.digitaloceanspaces.com and did the same. same result.

Thanks

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!