Skip to content

Instantly share code, notes, and snippets.

@dedg3
Forked from mikesprague/gist:5881937
Created January 24, 2019 20:40
Show Gist options
  • Save dedg3/8c155574134355ff78c27ef4b4a1cce4 to your computer and use it in GitHub Desktop.
Save dedg3/8c155574134355ff78c27ef4b4a1cce4 to your computer and use it in GitHub Desktop.
AWS: Bucket Policy Example (Allow Get by Referer)
{
"Version": "2008-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests from certain domains (including local development)",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name-here/*",
"Condition": {
"StringLike": {
"aws:Referer": [
"http://sub1.domain.com/*",
"https://sub1.domain.com/*",
"http://domain.com/*",
"https://*.domain.dev/*",
"https://*.domain.com/*",
"http://sub1.domain.dev/*",
"https://sub1.domain.dev/*",
"https://domain.com/*",
"http://s3.amazonaws.com/*",
"http://*.domain.com/*",
"http://app-name.herokuapp.com/*",
"https://app-name.herokuapp.com/*",
"https://s3.amazonaws.com/*",
"http://*.domain.dev/*",
"http://localhost*/*",
"http://localhost:*/*",
"https://localhost*/*",
"https://localhost:*/*"
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment