hotlink protection with rewrite

tophi nginx-forum at nginx.us
Sun Jul 17 13:32:50 UTC 2011


So not I'm not able to direct download the file, but videos also can not
be started from the website's player. I have changed *.mysite.com; also
with mysite.com and www.mysite.com, same result


Try this:

location ~ \.(swf|mp4)$ {
valid_referers server_names blocked *.mysite.com;
if ($invalid_referer) {
rewrite ^(.*)$ /hl.png break;
}
}

location =/hl.png {
root /home/tophi/www/images;
}

2011/7/16 tophi <nginx-forum at nginx.us>

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,39501,212485#msg-212485




More information about the nginx mailing list