Securing URLs with the Secure Link Module in NGINX

Francis Daly francis at
Mon Jun 17 16:43:01 UTC 2019

On Mon, Jun 17, 2019 at 03:17:46PM +0000, Andrew Andonopoulos wrote:

Hi there,

> Regarding the map, can you please explain which values the variables $one and $the_md5 will have?

Yes, but: what happens when you try it?

On a test system:

  location /vod/ {
    return 200 "one is $one; the_md5 is $the_md5;\n";

and request something like /vod/abc/123/hls/def/ghi.html

I think that the best way to learn and understand nginx, is to use nginx.

> My understanding of map directive is, request_uri will have the whole URI and will try to match it as per the regex. If there is a match then will pass the value to $one which will pass it to $the_md5?

Mostly correct.

"map" will compare its first argument (in this case, the expansion of
the variable $request_uri) with all of the "key" entries in its third
argument (the map) -- in this case, just one regex and one default.

If the regex matches, all of the (?P<>) named variables are populated
(because that's what a regex does).

Then "map" will set the variable named in its second argument ($the_md5)
to the matching value in the map -- which is the value of $one, in
this case.

So - it is the regex engine that sets the value of $one (and $the_time,
etc); and then "map" sets the value of $the_md5 to the current value
of $one.

Francis Daly        francis at

More information about the nginx mailing list