Migrating from Lighttpd : mod_secdownload show-stopper ?

Igor Sysoev igor at sysoev.ru
Thu Feb 10 23:25:49 MSK 2011


On Feb 10, 2011, at 23:06 , Igor Sysoev wrote:

> On Thu, Feb 10, 2011 at 11:25:23AM -0500, thoseg wrote:
>> And of course, I made a mistake with the example link provided... I
>> should have written : 
>> 
>> $prefix/$hash/$timestamp/$path/to/file.mp4
> 
> In 0.8.51+ you can try new ngx_http_secure_link_module functionality:
> 
>  /dir/MD5_HASH/TIMESTAMP/path/to/file.mp4
> 
>        location /dir/ {
>            location ~ ^/dir/(?<HASH>[\w\-=]+)/(?<TIME>\d+)(?<FILE>/.+)$ {
> 
>                secure_link       $HASH,$TIME;
>                secure_link_md5   $FILE.PaSsWoRd;

secure_link_md5   $FILE.$TIME.PaSsWoRd;

MD5_HASH = md5("/path/to/file.mp4.TIMESTAMP.PaSsWoRd") 

>                if ($secure_link = "") {    # no valid
>                    return 403;
>                }
> 
>                if ($secure_link == 0) {   # expired
>                    return 410;
>                }
> 
>                alias  /path/to$file;
>            }
> 
>            return 404;
> 
>            error_page  403       /forbidden.html;
>            error_page  404       /not_found.html;
>            error_page  410  =403 /link_expired.html;
>        }


--
Igor Sysoev
http://sysoev.ru/en/




More information about the nginx mailing list