ruby on rails - Prevent image hotlinking; only allow referer and redirected requests? -


I have some pictures in a bucket on S3. My app uses these images What I want is the following:

  • Allow only image access if:
    1. Referrer is my site - I can already do this with a bucket policy User redirected from my site

      Referer is sent to Amazon S3.

      Do I have any limits for accessing S3 files?

      My current bucket policy looks like this:

        {"version": "2008-10-17", "id": "e9c9be4d-cdfc-470c- 8582-1d5a9e4d04be "," Statement ": [" AWS ":" * "}," Action ":" S3: "" S: ":" Allow "," Principal ": {" AWS ":" GetAbject "," Resource ":" Ern: AAS: S3 ::: Mibecat / * "," Condition ": {" String Leak ": {" Aves: Referer ":" http://myapp.com/* " }}}}}    

      • make your files private.
      • Use the URL in the link / A Redirection in Ni images
        • Includes an expiration in the signed URL; Amazon will not show before your image expires.
        • The signed URLs can not be faked; Amazon will not show your image if the signature is missing Or illegal.

Comments