# Video stream and secure link

**URL:** <https://www.ruby-forum.com/t/video-stream-and-secure-link/221141>\
**Category:** NGINX\
**Created:** [July 2, 2012, 11:03am UTC](https://www.ruby-forum.com/t/video-stream-and-secure-link/221141 "2012-07-02T11:03:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 2, 2012, 11:03am UTC](https://www.ruby-forum.com/t/video-stream-and-secure-link/221141/1 "2012-07-02T11:03:28Z")

</div>

hi,

i want to use mp4 module and secure link module together.

this is my conf;  
location /videos/ {  
secure\_link $arg\_st,$arg\_e;  
secure\_link\_md5 ssss$remote\_addr$uri$arg\_e;  
if ($secure\_link = “”) {  
return 403;  
}

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

    mp4;

}

```

it works with this config but when i change mp4; with  
location ~ .mp4$ {  
mp4;  
}  
secure link doesn’t works. streaming an seeking working well.

i need to add this line because i want to stream flv files too.

wat is the true way ? thanks.

Posted at Nginx Forum:

> **[video stream and secure link](https://forum.nginx.org/read.php?2,228161,228161#msg-228161)**
>
> hi, i want to use mp4 module and secure link module together. this is my conf; location /videos/ { secure\_link $arg\_st,$arg\_e; secure\_link\_md5 ssss$remote\_addr$uri$arg\_e; if ($secure\_link = "") { return 403;

---

<div class="post-metadata">

**Author:** ![aryut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aryut](https://www.ruby-forum.com/u/aryut)\
**Post date:** [July 2, 2012, 11:56am UTC](https://www.ruby-forum.com/t/video-stream-and-secure-link/221141/2 "2012-07-02T11:56:06Z")

</div>

you can copy this location & paste beneath with flv instead of mp4

---

<div class="post-metadata">

**Author:** ![aryut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aryut](https://www.ruby-forum.com/u/aryut)\
**Post date:** [July 2, 2012, 4:26pm UTC](https://www.ruby-forum.com/t/video-stream-and-secure-link/221141/3 "2012-07-02T16:26:08Z")

</div>

i’ll try to explain again;

location /videos/ {  
/\*secure link module codes \*/  
mp4;  
} //secure link and mp4 streaming & seeking works well

location /videos/ {  
/\*secure link module codes \*/  
mp4;  
flv;  
} //secure links works. mp4 streaming & seeking doesnt works as should  
be.

location /videos/ {  
/\*secure link module codes \*/  
location ~ .mp4$ {  
mp4;  
}  
} //secure link doesn’t works, mp4 streaming & seeking works.

location /videos/ {  
/\*secure link module codes \*/  
mp4;  
location ~ .flv$ {  
flv;  
}  
} //secure link works on mp4 extension, but doesn’t works on flv.  
streamings & seekings works well.

location /videos/ {  
/\*secure link module codes \*/  
location ~ .mp4$ {  
mp4;  
}  
location ~ .flv$ {  
flv;  
}  
} //secure link doesn’t works on flv and mp4. streamings & seekings  
works well.

Posted at Nginx Forum:

> **[Re: video stream and secure link](https://forum.nginx.org/read.php?2,228161,228172#msg-228172)**
>
> hi, i want to use mp4 module and secure link module together. this is my conf; location /videos/ { secure\_link $arg\_st,$arg\_e; secure\_link\_md5 ssss$remote\_addr$uri$arg\_e; if ($secure\_link = "") { return 403;

---

<div class="post-metadata">

**Author:** ![aryut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aryut](https://www.ruby-forum.com/u/aryut)\
**Post date:** [April 1, 2016, 3:19pm UTC](https://www.ruby-forum.com/t/video-stream-and-secure-link/221141/4 "2016-04-01T15:19:16Z")

</div>

Hi, as I tried to write in this thread  
[Re: nginx HttpSecureLinkModule php streaming](https://forum.nginx.org/read.php?2,265663,265688#msg-265688) I’m trying  
to  
accomplish the same

But 1. did you get it to work 2. how did you form your link in the php  
script?

Posted at Nginx Forum:

> **[Re: video stream and secure link](https://forum.nginx.org/read.php?2,228161,265810#msg-265810)**
>
> hi, i want to use mp4 module and secure link module together. this is my conf; location /videos/ { secure\_link $arg\_st,$arg\_e; secure\_link\_md5 ssss$remote\_addr$uri$arg\_e; if ($secure\_link = "") { return 403;

---

<div class="post-metadata">

**Author:** ![aryut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aryut](https://www.ruby-forum.com/u/aryut)\
**Post date:** [July 2, 2012, 5:43pm UTC](https://www.ruby-forum.com/t/video-stream-and-secure-link/221141/5 "2012-07-02T17:43:52Z")

</div>

On Monday 02 July 2012 18:25:15 aryut wrote:

> flv;
> 
> works well.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#location)**
>
> This directive appeared in version 1.11.8.

> **[Module ngx\_http\_rewrite\_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)**

> **[Module ngx\_http\_secure\_link\_module](http://nginx.org/en/docs/http/ngx_http_secure_link_module.html)**

```
location /videos/ {
    secure_link $arg_st,$arg_e;
    secure_link_md5 ssss$remote_addr$uri$arg_e;

    location ~ \.mp4$ {

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

            mp4;
    }

    location ~ \.flv$ {

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

            flv;
    }
}

```

wbr, Valentin V. Bartenev
