# Nginx: : unknown "secure\_download" variable

**URL:** <https://www.ruby-forum.com/t/nginx-unknown-secure-download-variable/200238>\
**Category:** NGINX\
**Created:** [December 7, 2010, 5:03pm UTC](https://www.ruby-forum.com/t/nginx-unknown-secure-download-variable/200238 "2010-12-07T17:03:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 7, 2010, 5:03pm UTC](https://www.ruby-forum.com/t/nginx-unknown-secure-download-variable/200238/1 "2010-12-07T17:03:53Z")

</div>

I was following the example in [Secure Download | NGINX](http://wiki.nginx.org/HttpSecureDownload)  
but when I added this:

```
         if ($secure_download = "-1") {
             rewrite /expired.html break;
         }
         if ($secure_download = "-2") {
             rewrite /bad_hash.html break;
         }
         if ($secure_download = "-3") {
             return 500;
         }

```

nginx complains when starting:

nginx: [emerg]: unknown “secure\_download” variable

Ideas?

–

* * *

Robert La Ferla  
VP Engineering  
OMS SafeHarbor

This message (and any attachments) contains confidential information and  
is protected by law. If you are not the intended recipient, you should  
delete this message and are hereby notified that any disclosure,  
copying, distribution, or the taking of any action based on this  
message, is strictly prohibited.

---

<div class="post-metadata">

**Author:** ![Robert\_La\_Ferla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@Robert\_La\_Ferla](https://www.ruby-forum.com/u/Robert_La_Ferla)\
**Post date:** [December 7, 2010, 5:13pm UTC](https://www.ruby-forum.com/t/nginx-unknown-secure-download-variable/200238/2 "2010-12-07T17:13:57Z")

</div>

1. 

```
        secure_download on;
     secure_download_secret IAmSalt$remote_addr;
     secure_download_path_mode file;

```

?

1. 

> **[NGINX 3rd Party Modules | NGINX](https://www.nginx.com/resources/wiki/modules/index.html)**
>
> A list of third party modules for NGINX.

/configure --add-module=/path/to/module1/source   
–add-module=/path/to/module2/source  
?

Tue, 07 Dec 2010 11:02:01 -0500 Robert La Ferla  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Robert\_La\_Ferla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@Robert\_La\_Ferla](https://www.ruby-forum.com/u/Robert_La_Ferla)\
**Post date:** [December 7, 2010, 7:58pm UTC](https://www.ruby-forum.com/t/nginx-unknown-secure-download-variable/200238/3 "2010-12-07T19:58:56Z")

</div>

Try to use standart HttpSecureLinkModule  
[Module ngx\_http\_secure\_link\_module](http://wiki.nginx.org/HttpSecureLinkModule), if you don’t want change  
source code for HttpSecureDownload  
module.

Tue, 07 Dec 2010 11:27:01 -0500 Robert La Ferla  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Robert\_La\_Ferla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@Robert\_La\_Ferla](https://www.ruby-forum.com/u/Robert_La_Ferla)\
**Post date:** [December 7, 2010, 5:28pm UTC](https://www.ruby-forum.com/t/nginx-unknown-secure-download-variable/200238/4 "2010-12-07T17:28:23Z")

</div>

Sorry I didn’t include those but they ARE in the file. Here’s a bigger  
snippet of our config:

```
 # HTTPS server
 #
 server {
     listen ouripaddressandport
     server_name ourserver

```

sendfile on;

## TCP options

tcp\_nopush on;  
tcp\_nodelay on;

```
     access_log logs/https.access.log main;

     ssl on;
     ssl_certificate ourcert
     ssl_certificate_key ourkey

     ssl_session_timeout 5m;

     ssl_protocols SSLv2 SSLv3 TLSv1;
     ssl_ciphers

```

ALL:!ADH:!EXPORT56:RC4+RSA:!HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;  
ssl\_prefer\_server\_ciphers on;

```
     location / {
         root html;
         index index.html index.htm;
     }

     location /secure {
         secure_download on;
         secure_download_secret oursecret;
         secure_download_path_mode file;
         secure_download_fail_location /error.html;

         if ($secure_download = "-1") {
            rewrite /expired.html break;
         }
         if ($secure_download = "-2") {
             rewrite /bad_hash.html break;
         }
         if ($secure_download = "-3") {
             return 500;
         }

     }

```

On 12/7/2010 11:13 AM, Ivan wrote:

> ?
> 
> > }
> > 
> > protected by law. If you are not the intended recipient, you should delete
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–

* * *

Robert La Ferla  
VP Engineering  
OMS SafeHarbor

This message (and any attachments) contains confidential information and  
is protected by law. If you are not the intended recipient, you should  
delete this message and are hereby notified that any disclosure,  
copying, distribution, or the taking of any action based on this  
message, is strictly prohibited.
