如何仅将 HLS 流配置为 Ant Media Server 中定义的 IP 地址?

How can I configure HLS streams only to defined IP addresses in Ant Media Server?

我希望某些 IP 地址能够观看我的 HLS 流。我该如何限制它?

最简单的方法是设置反向代理。示例配置文件如下。

       location / {

            location ~* \.(m3u8)$ {
                    proxy_pass http://127.0.0.1:5080;
                    allow 1.1.1.1/32; # IP addresses that you will allow
                    deny all;
            }
            proxy_pass http://127.0.0.1:5080;
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
        }