# Nginx-0.8.50

**URL:** <https://www.ruby-forum.com/t/nginx-0-8-50/194336>\
**Category:** NGINX\
**Created:** [September 2, 2010, 5:04pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336 "2010-09-02T17:04:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 2, 2010, 5:04pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/1 "2010-09-02T17:04:52Z")

</div>

Changes with nginx 0.8.50 02 Sep  
2010

```
*) Feature: the "secure_link", "secure_link_md5", and
   "secure_link_expires" directives of the 

```

ngx\_http\_secure\_link\_module.

```
*) Feature: the -q switch.
   Thanks to Gena M..

*) Bugfix: worker processes may got caught in an endless loop during
   reconfiguration, if a caching was used; the bug had appeared in
   0.8.48.

*) Bugfix: in the "gzip_disable" directive.
   Thanks to Derrick Petzold.

*) Bugfix: nginx/Windows could not send stop, quit, reopen, and 

```

reload  
signals to a process run in other session.

–  
Igor S.  
[http://sysoev.ru/en/](http://sysoev.ru/en/)

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 2, 2010, 5:32pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/2 "2010-09-02T17:32:59Z")

</div>

> Changes with nginx 0.8.50 02 Sep  
> 2010
> 
> \*) Feature: the “secure\_link”, “secure\_link\_md5”, and  
> “secure\_link\_expires” directives of the ngx\_http\_secure\_link\_module.

As already in the russian list ppl asked - could you explain the  
directives  
(some wiki/doc update) or even quick config example.

Anyways thanks for the nice work Igor.

–  
rr

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 2, 2010, 5:53pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/3 "2010-09-02T17:53:28Z")

</div>

On Thu, Sep 02, 2010 at 06:31:32PM +0300, Reinis R. wrote:

> > Changes with nginx 0.8.50 02 Sep  
> > 2010
> > 
> > \*) Feature: the “secure\_link”, “secure\_link\_md5”, and  
> > “secure\_link\_expires” directives of the ngx\_http\_secure\_link\_module.
> 
> As already in the russian list ppl asked - could you explain the directives  
> (some wiki/doc update) or even quick config example.

These directive add a new mode of the module operation.  
Here is configuration example:

```
    location /p/ {
        location ~ ^/p/(?<secure>[\w\-=]+,\d+)(?<file>/.+)$ {

            secure_link $secure;
            secure_link_md5 

```

$secure\_link\_expires.$file.PASSWORD;  
secure\_link\_expires on;

```
            if ($secure_link = "") {
                return 403;
            }

            if ($secure_link == 0) {
                return 410;
            }

            alias /path/to$file;
        }

        return 404;

        error_page 403 /forbidden.html;
        error_page 404 /not_found.html;
        error_page 410 =403 /link_expired.html;
    }

```

The “secure\_link” directive specifies how to get hash and optional  
expiration time. The hash is md5 hash encoded in base64 for URIs  
(i.e., where “+” and “/” are changed to “-” and “\_”). The optional time  
goes after “,”.  
You can set hash in a URI, in a query string ($arg\_secure), or in a  
cookie  
($cookie\_secure).

The “secure\_link\_expires” directive specifies should the module test  
the expiration time. You may add the time in URI, etc., but may not test  
it.  
The $secure\_link\_expires variable has the time value exctracted by  
“secure\_link” directive.

The “secure\_link\_md5” directive specifies string for md5 hash.

The $secure\_link variable has the following values:

“” - no valid link  
“0” - expired link  
“1” - valid link

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 2, 2010, 8:39pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/4 "2010-09-02T20:39:45Z")

</div>

On Thu, Sep 02, 2010 at 07:52:26PM +0400, Igor S. wrote:

> ```
> if ($secure_link = "") {
> return 404;
> 
> ```
> 
> You can set hash in a URI, in a query string ($arg\_secure), or in a cookie
> 
> “” - no valid link  
> “0” - expired link  
> “1” - valid link

Now I see that the “secure\_link\_expires” directive is surplus here:  
if we want to test expiration time, we can do using “if ($secure\_link =  
0)”.  
So I will remove it in the next release.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 3, 2010, 3:17am UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/5 "2010-09-03T03:17:52Z")

</div>

the same problem as [nginx 0.8.45-0.8.49 segfault bug](http://forum.nginx.org/read.php?2,125959)

Posted at Nginx Forum:

> **[Re: nginx-0.8.50](https://forum.nginx.org/read.php?2,126366,126588#msg-126588)**
>
> Changes with nginx 0.8.50 02 Sep 2010 \*) Feature: the "secure\_link", "secure\_link\_md5", and "secure\_link\_expires" directives of the ngx\_http\_secure\_link\_module. \*) Feature: the -q swi

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 8, 2010, 3:43pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/6 "2010-09-08T15:43:30Z")

</div>

chids Wrote:

> What am I missing?

What I was missing was of course the ability to combined the  
information:

> The hash is md5 hash encoded in base64 for URIs (i.e., where “+” and  
> “/” are changed to “-” and “\_”)

In combination with my location regex which didn’t match on “-” and “\_”

Sorry for not paying proper attention to what was already explained.

regards  
MÃ¥rten

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,126366,128410#msg-128410](http://forum.nginx.org/read.php?2,126366,128410#msg-128410)

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [September 8, 2010, 2:30pm UTC](https://www.ruby-forum.com/t/nginx-0-8-50/194336/7 "2010-09-08T14:30:53Z")

</div>

## Igor S. Wrote:

> Changes with nginx 0.8.50  
> 02 Sep 2010
> 
> ```
> *) Feature: the "secure_link",
> 
> ```
> 
> “secure\_link\_md5”, and  
> “secure\_link\_expires” directives of the  
> ngx\_http\_secure\_link\_module.

Hello!

While this is a very welcome enhancement to this module I’m having a  
hard time figuring out its correct usage. It appears (to me) that  
there’s a limitation (bug?) in the base64 decoding.

As a simple test case I use:

location ~ ^/a/(?[0-9a-zA-Z+/=]+) {  
secure\_link\_md5 “a”;  
secure\_link “$key”;  
if ($secure\_link = “”) {  
return 501;  
}  
if ($secure\_link != “”) {  
return 502;  
}  
}

A request to [http://127.0.01:8182/a/DMF1ucDxtqgxw5niaXcmYQ==](http://127.0.01:8182/a/DMF1ucDxtqgxw5niaXcmYQ==) then  
returns 502 as expected.

However if I change from:  
secure\_link\_md5 “a”;  
to:  
secure\_link\_md5 “b”;  
and place a request to [http://127.0.01:8182/a/kutf/uauL+w61xx3dTFXjw==](http://127.0.01:8182/a/kutf/uauL+w61xx3dTFXjw==)  
I receive a 501. I immediately thought is was the / in the base64  
encoded data that caused this and tried to URL encode the base64 string  
but it doesn’t seem to work. I also tried using the “URL applications”  
variant of Base 64 without any success.

What am I missing?

regards  
MÃ¥rten Gustafson

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,126366,128387#msg-128387](http://forum.nginx.org/read.php?2,126366,128387#msg-128387)
