Welcome! Log In Create A New Profile

Advanced

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly
June 17, 2019 11:06AM
On Mon, Jun 17, 2019 at 01:34:33PM +0000, Andrew Andonopoulos wrote:

Hi there,

> The idea of moving MD5 and Time after the first directory is good.
> So with this option i will not have to worry modifying the manifests.

Correct.

Since the manifests refer to "other files in the same directory", the
same md5sum value will apply to them all, and the client should just
ask for the correct thing each time.

> If i use this URL: /vod/MD5/TIME/hls/directory/files
>
> The locations will be like this?
>
> location ^~ /vod/"

More or less, yes. The first line there would probably be:

location ^~ /vod/ {

but the rest looks right. You'll want to change the secure_link_md5 line
to match what you want, of course.

> Also i will need to capture the variables:
> Then I would use "map" to set variables $the_md5, $the_time,
> $the_directory, and $the_file from the incoming request.
>
> Do you have an example how to write the map with the appropriate regex?

One way to set all of the variables at once (assuming the request is
well-formed) would be something like:

map $request_uri $the_md5 {
default "";
~^/vod/(?P<one>[^/]+)/(?P<the_time>[0-9]+)(?P<the_directory>.*)/(?P<the_file>[^/]+) $one;
}

where "$the_md5" becomes "all of the non-slashes after /vod/", $the_time
becomes "all of the numbers after that", $the_directory becomes
"everything else up to the last slash", and $the_file is "everything
after the last slash".

You will probably want to change things such that "/hls" is either
excluded from $the_directory, or excluded from the rewrite directive.

You can check the debug log, or temporarily do things like

return 200 "md5 = $the_md5; file=$the_file;\n";

to see what values the variables have when you are testing.

You can use "curl" to make a test request and see whether the response
is what you expect.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Securing URLs with the Secure Link Module in NGINX

Andrew Andonopoulos June 06, 2019 07:02PM

Re: Securing URLs with the Secure Link Module in NGINX

Patrick June 06, 2019 08:30PM

Re: Securing URLs with the Secure Link Module in NGINX

Andrew Andonopoulos June 07, 2019 02:50PM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 07, 2019 05:00PM

Re: Securing URLs with the Secure Link Module in NGINX

Andrew Andonopoulos June 07, 2019 05:52PM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 07, 2019 06:36PM

Re: Securing URLs with the Secure Link Module in NGINX

Andrew Andonopoulos June 08, 2019 10:46AM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 09, 2019 04:16AM

Re: Securing URLs with the Secure Link Module in NGINX

andregr-jp June 15, 2019 02:10PM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 17, 2019 03:42AM

Re: Securing URLs with the Secure Link Module in NGINX

andregr-jp June 17, 2019 04:20AM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 17, 2019 07:40AM

Re: Securing URLs with the Secure Link Module in NGINX

andregr-jp June 17, 2019 09:36AM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 17, 2019 11:06AM

Re: Securing URLs with the Secure Link Module in NGINX

andregr-jp June 17, 2019 11:18AM

Re: Securing URLs with the Secure Link Module in NGINX

Francis Daly June 17, 2019 12:44PM

Re: Securing URLs with the Secure Link Module in NGINX

Hung Nguyen June 17, 2019 08:02AM

Re: Securing URLs with the Secure Link Module in NGINX

andregr-jp June 17, 2019 08:26AM

Re: Securing URLs with the Secure Link Module in NGINX

andregr-jp June 17, 2019 09:00AM

Re: Securing URLs with the Secure Link Module in NGINX

Hung Nguyen June 17, 2019 12:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 247
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready