Last active
December 11, 2015 21:09
-
-
Save elasticdog/4660155 to your computer and use it in GitHub Desktop.
AWS S3 Bucket Policy to Deny Hotlinking Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Id": "http referer policy", | |
"Statement": [ | |
{ | |
"Sid": "Allow GET requests", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::elasticdog.com/*" | |
}, | |
{ | |
"Sid": "Deny hotlinking images", | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::elasticdog.com/images/*", | |
"Condition": { | |
"StringNotLike": { | |
"aws:Referer": [ | |
"http://elasticdog.com/*", | |
"https://elasticdog.com/*", | |
"http://elasticdog.com.s3-website-us-west-2.amazonaws.com/*", | |
"https://elasticdog.com.s3-website-us-west-2.amazonaws.com/*" | |
] | |
}, | |
"Null": { | |
"aws:Referer": false | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment