I have a Next.js app, using the new next/image feature, getting 403-Access denied when attempting to access S3 objects with the following policy:
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicRead",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": "arn:aws:s3:::bucket-name/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"https://my-website.com/*",
"http://localhost:3000/*"
]
}
}
}
]
}
The referer is included in the request header as below, as required by S3's docs:
If I do remove the Condition from the above policy, it will give access to the image, but that is not what I am looking for.
I have seen related questions in SO and elsewhere by the way, but they do not address this specific issue.
