gog
January 14, 2010 08:28AM
I stumbled upon the exact same problem today while moving our site from Lighttpd to nginx.

This is how we solved it:

Link to our protected files look like this:

/pdf/number.pdf/MD5_hash/hex_of_timestamp

and this is our location directive:

[code]
# PDF download
location /pdf {
secure_download on;
secure_download_secret $request_addr;
secure_download_path_mode file;

if ($uri ~ "^/pdf/(.+\.pdf)$") {
set $filename $1;
}
add_header Content-Disposition "attachment; filename=$filename";
}
[/code]

As you can see from the example we are extracting the filename from the request uri and setting the appropriate header.
Subject Author Posted

Rewrite module and secure download

trinsic December 15, 2009 11:42PM

Re: Rewrite module and secure download

Maxim Dounin December 16, 2009 12:00AM

Re: Rewrite module and secure download

gog January 14, 2010 08:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready