Skip to content

Instantly share code, notes, and snippets.

@benhagen
Created December 3, 2013 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benhagen/7778853 to your computer and use it in GitHub Desktop.
Save benhagen/7778853 to your computer and use it in GitHub Desktop.
S3 bucket policy to restrict access by referer.
{
"Id": "Restrict access to S3 keys by HTTP referer header",
"Statement": [
{
"Sid": "S3 Referer Header Check",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::static.hx.io/*",
"Condition": {
"StringLike": {
"aws:Referer": "http://hx.io/*",
"aws:Referer": "https://hx.io/*"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment