nginx as reverse proxy with "mod secdownload" feature - possible?
r at roze.lv
Tue Oct 19 19:10:08 MSD 2010
> nginx has no feature like mod_secdownload so far, right? Is there anything
> could do to get nginx working as a proxy with something like
> maybe some perl module or so? the important thing would just be to have
> picture/video only downloaded once, or at least once in xx days...
I havent followed what is the current status with the TTL (time to live)
secure downloads ( there is some blog post
http://www.masterzen.fr/2009/07/18/nginx-secure-link-module-with-ttl/ ) but
we use http://wiki.nginx.org/HttpSecureLinkModule
The secure link configuration is put on the caching servers (while of course
you can duplicate it also on the backend in case you want to support also
direct requests) which then fetch the object (if it doesnt exist in cache
(local tree)) from backend via normal url (and do proxy_store locally) - the
url normalising (striping out the hash parts) allows to store the same
object just once).
But to implement the download-once feature you could use php (or any other
dynamic backend) and do it via X-Accel-Redirect (
http://wiki.nginx.org/XSendfile ) - like transparently parse all the file
downloading requests (through either try_files or rewrite) and let php
decide if the file is available or not and nginx just does the transfer.
More information about the nginx