A lot of multimedia driven sites have the problem of people linking and embedding their content without their explicit permission. This not only leads to copyright issues at times, but also ends up in lost bandwidth for the site minus the traffic. This is clearly not a good scenario for any site. This recipe helps you prevent this situation on your site.
This simple rule will stop other sites from linking to your content:
server { server_name www.example1.com; location ~* ^.+\.(jpg|jpeg|gif)$ { valid_referers none blocked example1.com www.example1.com; if ($invalid_referer) { return 444; } } ... }
The idea behind this is to set a list of correct referrer values which are permissible. The rest are rejected. In case there is no match with this list the variable, $invalid_referer
is set to 1. The lists of parameters in the valid_referers
mean the following:
parameter |
Meaning |
---|---|
None |
This value implies that... |