hotlink protection with rewrite

Wendal Chen wendal1985 at gmail.com
Sun Jul 17 13:06:44 UTC 2011


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>

> None of the above methos has helped me.
> My files are .swf and .mp4 .
> Here is an example of my conf
>
>
> valid_referers none blocked mysite.com;
> location /home/tophi/www/files/
> {
> if ($invalid_referer) {
> rewrite ^ /home/tophi/www/images/hl.png last;
> }
> }
>
>
> location ~ \.(swf|mp4)$ {
> valid_referers server_names blocked *.mysite.com;
> if ($invalid_referer) {
> rewrite ^(.*)$ /home/tophi/www/images/hl.png break;
> }
> }
>
> please advice
> thanks
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,39501,212475#msg-212475
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



-- 
Wendal Chen
<http://t.sina.com.cn/1068040557?s=6uyXnP>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110717/c9999338/attachment.html>


More information about the nginx mailing list