Securing URLs with Secure Link + HLS

LewisMM nginx-forum at forum.nginx.org
Wed Aug 31 15:16:23 UTC 2022


Hi,

I've been following this resource:
https://www.nginx.com/blog/securing-urls-secure-link-module-nginx-plus/

On that page, the final section "Securing Segment Files with an Expiration
Date". It does not work.


map $uri $file_name {
    default none;
    "~*/s/(?<name>.*).m3u8" $name;
    "~*/s/(?<name>.*).ts" $name;
}

server {
    listen 80;
    server_name secure-link-demo;

    location /s {
        root /opt;
        secure_link $arg_md5,$arg_expires;
        secure_link_md5 "$secure_link_expires$file_name$http_user_agent
enigma";

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


This works with the .M3U8 playlist file. It successfully secures it.
However, when the playlist tries to load the segment files (.ts) files, I
get a 403 error. Nginx is not passing the MD5 hash to the segment files.

Does anyone know how to fix this?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,295058,295058#msg-295058



More information about the nginx mailing list