Skip to content

Instantly share code, notes, and snippets.

@rpstreef
Last active September 15, 2017 06:26
Show Gist options
  • Select an option

  • Save rpstreef/b17cac9ef0e09e7f6a6bbe5407c7488c to your computer and use it in GitHub Desktop.

Select an option

Save rpstreef/b17cac9ef0e09e7f6a6bbe5407c7488c to your computer and use it in GitHub Desktop.
S3 bucket policy for http referrer
{
"Version": "2008-10-17",
"Id": "http referer policy",
"Statement": [
{
"Sid": "Allow get requests from YOUR.URL",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR.URL/*",
"Condition": {
"StringLike": {
"aws:Referer": "YOUR.URL/*"
}
}
},
{
"Sid": "Deny get requests from other domains",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR.URL/*",
"Condition": {
"StringNotLike": {
"aws:Referer": "YOUR.URL/*"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment