arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.45k stars 3.51k forks source link

Distant auth script (https) on_publish #801

Open Harest opened 8 years ago

Harest commented 8 years ago

Hi,

We've a site (on server 1) for an event, and another server (2) specifically for RTMP streams. Basically many users will be able to stream on the server 2. And these users are registered on the site (server 1).
We'd like to set the on_publish parameter (serv 2) with an url of a script hosted on the serv 1. It appears for now there's no request done from serv 2 to serv 1 (no entry in access log) and any stream will be "accepted".
Is there any restriction in nginx-rtmp-module about this ? Should the auth script be on the serv 2 (localhost then) and a special access should be created to the database ?
Note that apparently https url aren't accepted (invalid port in url) in this on_publish parameter so we put http instead but this mean there'll be a 301 redirection before anything in the current config. Maybe this is why there's no entry in the access.log of serv 1. Edit : I just added a log on http requests, and i've the requests from the serv 2 on the serv 1. So yep, the module don't care about 301 redirection, and https is "invalid port", any way to solve this ? Edit 2 : We choose to put the auth script on the serv 2 with a very restricted mysql user. Problem solved.

When tested with a localhost script (nginx-rtmp-auth, for testing purpose), it worked.

misiek08 commented 8 years ago

It should work using local location and proxy_pass inside it. This way you can use https and if you separate http and rtmp instances you can change auth url without the need to restart rtmp instance.

ocktech commented 6 years ago

Can you please give examples of this? I am no developer but i should be able to follow instructions if clear. thanks.