title: Amazon S3 : How to allow access to a specific path, only for a specific referer?
body: <p>I have a Amazon S3 bucket <code>mybucket</code> and only want to enable access to content in a specific nested folder (or in S3 terms, with a specific "prefix").</p>
  
  <p>I tried the following S3 bucket policy but it doesn't work. After adding the condition I started getting access denied errors in the browser.</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Id": "Policy for mybucket",
      "Statement": [
          {
              "Sid": "Allow access to public content only from my.domain.com",
              "Effect": "Allow",
              "Principal": "*",
              "Action": "s3:GetObject",
              "Resource": "arn:aws:s3:::mybucket/public/content/*",
              "Condition": {
                  "StringLike": {
                      "aws:Referer": [
                          "http://my.domain.com/*"
                      ]
                  }
              }
          }
      ]
  }
  </code></pre>
  
  <p>What should the policy look like to achieve this?</p>