I followed the documentation to configure the download file, but I got an error 404.
documenttaion: https://www.nginx.com/resources/wiki/modules/secure_download/#secure-download-secret
this is my configation code.can you help me.
`location /somefolder {
secure_download on;
secure_download_secret KgKLp;
secure_download_path_mode file;
if ($secure_download = "-1") {
rewrite /expired.html break;
}
if ($secure_download = "-2") {
rewrite /bad_hash.html break;
}
if ($secure_download = "-3") {
return 500;
}
rewrite ^(.*)/[0-9a-zA-Z]*/[0-9a-zA-Z]*$ $1 break;
}`
I have a file in my document root under the path /somefolder/protected.html.
I create the url with the following code:
` public static void main(String[] args) {
var str = "/somefolder/protected.html/KgKLp/1715158623";
MD5 md5 = MD5.create();
var digest = md5.digestHex(str);
var url = "/somefolder/protected.html/" + digest + "/1715158623";
System.out.printf(url); ///somefolder/protected.html/ffa42944fd9de29db2e4458d509873d2/1715158623
}`
I request the url(https://...*:8080/somefolder/protected.html/ffa42944fd9de29db2e4458d509873d2/1715158623)
and i get an error 404. I dont know why. can you help me.
gufeng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.