Migrating from Lighttpd : mod_secdownload show-stopper ?

Igor Sysoev igor at sysoev.ru
Thu Feb 10 23:06:03 MSK 2011


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;

                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