Preventing Amazon Cloudfront hotlinking

前端 未结 7 1822
孤独总比滥情好
孤独总比滥情好 2020-12-08 15:18

I use Amazon Cloudfront to host all my site\'s images and videos, to serve them faster to my users which are pretty scattered across the globe. I also apply pretty aggressi

7条回答
  •  暖寄归人
    2020-12-08 15:56

    As of Oct. 2015, you can use AWS WAF to restrict access to Cloudfront files. Here's an article from AWS that announces WAF and explains what you can do with it. Here's an article that helped me setup my first ACL to restrict access based on the referrer.

    Basically, I created a new ACL with a default action of DENY. I added a rule that checks the end of the referer header string for my domain name (lowercase). If it passes that rule, it ALLOWS access.

    After assigning my ACL to my Cloudfront distribution, I tried to load one of my data files directly in Chrome and I got this error:

提交回复
热议问题