Welcome! Log In Create A New Profile

Advanced

location condition + secure_link

Posted by Absturz 
location condition + secure_link
May 06, 2011 10:26AM
Hello, I have a hard time figuring out the correct configuration.

I have an URL - e.g.
http://example.com/[md5-checksum]/[num-value-1]/[num-value-2]/[file-name]
http://example.com/ac64392dba67d618ea6a76843c006708/123/56789/test.jpg

I want to make sure that the md5-checksum matches salt + num-value-2. So the file name and num-value-1 should be ignored (only needed for the filename header) in order to build the md5 checksum.

Following configuration does not result in what I want to achieve. I appreciate any help!


location ~* ^/download/([a-zA-Z0-9]+)/([0-9]+)/([0-9]+)/(.*)$ {

secure_link $3;
secure_link_md5 segredo$3;

if ($secure_link = "") {
return 500;
}

set $filename $4;
add_header Content-Disposition "attachment; filename=$filename";
rewrite ^/download/([a-zA-Z0-9]+)/([0-9]+)/([0-9]+)/(.*)$ /$2/$3 break;

}
Re: location condition + secure_link
May 09, 2011 01:15PM
Following line:
secure_link $3

should have been:
secure_link $1
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 103
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