I have a bucket policy for restricting access of files with "--original" in the filename, but it only works if you put in the URL directly into the browser. If you click "open image in new tab" then it shows up just fine (I assume because the http referer is indeed from that site). I need to give access to the website to show the image, but if in a new tab or trying to download, it doesn't get access. Do I need to put some sort of redirect in?
Here's my bucket policy:
{
"Version": "2012-10-17",
"Id": "Deny file access",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": "arn:aws:s3:::examplebucket/*--original*",
"Condition": {
"StringNotLike": {
"aws:Referer": [
"https://examplebucket.com*",
"https://examplebucket.dev*"
]
}
}
}
]
}