<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello Francis and thank you for the response.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In my case the player will request the m3u8 URL:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://cdn1.cdnlotus.com/hls/justin-timberlake-encrypted/playlist.m3u8?md5=u808mTXsFSpZt7b8wLvlIw&expires=1560706367" id="LPlnk687223">https://<domain>/hls/justin-timberlake-encrypted/playlist.m3u8?md5=u808mTXsFSpZt7b8wLvlIw&expires=1560706367</a><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The response from the server will be:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>#EXTM3U<br>
</span>
<div>#EXT-X-VERSION:3<br>
</div>
<div>#EXT-X-STREAM-INF:BANDWIDTH=200000,RESOLUTION=416x234<br>
</div>
<div>Justin_Timberlake_416_234_200.m3u8<br>
</div>
<div>#EXT-X-STREAM-INF:BANDWIDTH=300000,RESOLUTION=480x270<br>
</div>
<div>Justin_Timberlake_480_270_300.m3u8<br>
</div>
<div>#EXT-X-STREAM-INF:BANDWIDTH=600000,RESOLUTION=640x360<br>
</div>
<div>Justin_Timberlake_640_360_600.m3u8<br>
</div>
<div>#EXT-X-STREAM-INF:BANDWIDTH=900000,RESOLUTION=960x540<br>
</div>
<div>Justin_Timberlake_960_540_900.m3u8<br>
</div>
<div>#EXT-X-STREAM-INF:BANDWIDTH=1300000,RESOLUTION=1280x720<br>
</div>
<span>Justin_Timberlake_1280_720_1300.m3u8</span><br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
After that the player will request the bitrate m3u8 files (as per the main manifest) which includes the ts files. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
for example:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<a href="https://cdn1.cdnlotus.com/hls/justin-timberlake-encrypted/playlist.m3u8?md5=u808mTXsFSpZt7b8wLvlIw&expires=1560706367" style="margin: 0px; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)" id="LPlnk384113">https://<domain>/hls/justin-timberlake-encrypted/Justin_Timberlake_416_234_200.m3u8</a><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Can I instruct Nginx to use secure link only for the playlist.m3u8 and not for the other m3u8 and ts files?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
The map config that i am using now is:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>#map $uri $hls_uri { <br>
</span>
<div> ~^(?<base_uri>.*).m3u8$ "<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">base_uri</span>";
<br>
</div>
<div> ~^(?<base_uri>.*).ts$ "<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">base_uri</span>";
</div>
<div> default $uri; <br>
</div>
<span> } </span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Andrew</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> nginx <nginx-bounces@nginx.org> on behalf of Francis Daly <francis@daoine.org><br>
<b>Sent:</b> Sunday, June 9, 2019 8:15 AM<br>
<b>To:</b> nginx@nginx.org<br>
<b>Subject:</b> Re: Securing URLs with the Secure Link Module in NGINX</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">On Sat, Jun 08, 2019 at 02:44:22PM +0000, Andrew Andonopoulos wrote:<br>
<br>
Hi there,<br>
<br>
> Thanks for the clarification, so all requests will be like this:<br>
> <br>
> http://<domain>/hls/<content folder name>/<content filename><br>
> <br>
> can i include in the map the domain <a href="http://example.com">http://example.com</a>, the folder /hls/ and ignore all the rest?<br>
<br>
You can. I'm not sure why you would.<br>
<br>
The "map" is only a way to create a variable.<br>
<br>
The important part is what you do with that variable - for example,<br>
in one of the secure_link* directives.<br>
<br>
<br>
You said that the task was "to use secure link to secure m3u8 and<br>
ts files".<br>
<br>
What do you understand by the phrase "to secure", there?<br>
<br>
It is possible that the secure link module does not do what you want to<br>
have done.<br>
<br>
Presumably you want to allow some access and disallow some other<br>
access. Possibly you only care about time-limited access?<br>
<br>
I suspect that the details will matter.<br>
<br>
>From a "secret url" point of view: telling someone to<br>
access <a href="http://example.com/dir/file.m3u">http://example.com/dir/file.m3u</a> is exactly the same as<br>
telling them to access <a href="http://example.com/dir/file.m3u?secret">http://example.com/dir/file.m3u?secret</a> or<br>
<a href="http://example.com/dir/secret/file.m3u">http://example.com/dir/secret/file.m3u</a> -- you give them a url, and you<br>
configure your nginx such that anyone who accesses that url gets the<br>
file contents. The "secret" part might stop them guessing how to get<br>
file.ts in the same directory; but only if it is not the same secret<br>
for all file names.<br>
<br>
(You *could* issue different secret urls for different users; but I<br>
don't think that that is what you are doing here.)<br>
<br>
<br>
>From a "time-limited" point of view, you could tell<br>
someone to access <a href="http://example.com/dir/file.m3u?time">http://example.com/dir/file.m3u?time</a><br>
or <a href="http://example.com/dir/file.m3u?secret&time">http://example.com/dir/file.m3u?secret&time</a> or<br>
<a href="http://example.com/dir/secret/time/file.m3u">http://example.com/dir/secret/time/file.m3u</a>, and configure your nginx<br>
to send the file contents only until "time". The secret/secure_link part<br>
is to stop someone adding a week to "time" and getting access for longer<br>
than they should.<br>
<br>
Or you could just "rm dir/file.m3u" when you no longer want it accessible.<br>
<br>
<br>
There are good use-cases for the secure_link module.<br>
<br>
But you should probably start with what you want to achieve; and then<br>
see whether secure_link is the right answer. And then the mechanics of<br>
configuring nginx to do what you want can be sorted out afterwards.<br>
<br>
f<br>
-- <br>
Francis Daly francis@daoine.org<br>
_______________________________________________<br>
nginx mailing list<br>
nginx@nginx.org<br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div>
</span></font></div>
</div>
</body>
</html>