nginx-rtmp-module
nginx-rtmp-module copied to clipboard
Authentication Does not work
Hello,
i have configured authentication as follows:
rtmp {
server {
listen 1935;
chunk_size 8192;
application hls {
on_play http://url.com/auth;
on_publish http://url.com/auth;
live on;
meta copy;
hls on;
hls_path /tmp/hls;
}
}
}
Still, I can publish streams to the server without a problem or without given arguments at all. The auth-url provides a 404 when password is wrong (as described here https://smartshitter.com/musings/2017/12/nginx-rtmp-streaming-with-simple-authentication/)
Whats going wrong here?
Thank you
Try making the auth page throw a 500 error code for a failure. 200 to allow.
Thank you for the reply :)
Still, it doesn't work like that :-( I can publish streams and it works even when explicit providing wrong pw.
RTMP-Server:
rtmp { server { listen 1935; chunk_size 8192;
application hls {
on_play http://url.com/auth;
on_publish http://url.com/auth;
live on;
meta copy;
hls on;
hls_path /tmp/hls;
}
}
}
server {
Auth directive:
listen 80;
server_name tv.url.com;
location /auth {
if ($arg_psk = 'totallysecretpassword') {
return 200;
}
return 500;
}
}
I don't know if you have found the solution for this. Did you try adding "notify_method get;" below chunk size in rtmp conf?
Are you using HTTPS/SSL on your server? NGINX will refuse to check a route if you try HTTP while HTTPS is active, even on localhost
I think @Ashsanti is right. rtmp module use POST method as default http method. you need to add "notify_method get" to change it to the GET method Directives#notify_method
the on_play is not called with hls, you have to use nginx http classic authentication I think but it is not working for me if someone has successfully done this in pass please help