Migrating from Lighttpd : mod_secdownload show-stopper ?

Reinis Rozitis r at roze.lv
Thu Feb 10 21:22:01 MSK 2011


> Do you have any advices/ideas to help me mimick Lighty's 
> "mod_secdownload", please ? Actually, my application produce links like 
> this one :
> /$prefix/$path/to/file.mp4/$hash/$timestamp

One way to work arround this would be to use X-Accel-Redirect  ( 
http://wiki.nginx.org/XSendfile) and rewrite (or with try_file) requests to 
some script (like php, perl or ruby) and make the decision on application 
level (would require just few lines of code to verify the hash/timestamp but 
you could even check against DB etc) while still pushing the file directly 
through nginx.

Few articles:
http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
http://kovyrin.net/2010/07/24/nginx-fu-x-accel-redirect-remote/


rr 




More information about the nginx mailing list