Nginx-rtmp-module: Add support for https-urls in notify methods.

Created on 30 Sep 2015  ·  7Comments  ·  Source: arut/nginx-rtmp-module

We have a use-case where we have to authenticate rtmp-sessions against an API which is only available on https.

It seems that one currently cannot use https-urls in methods like on_publish, so we've worked around the problem by using nginx as an http->https proxy like this:

on_publish http://localhost/api-https-proxy/....;
location /api-https-proxy {
     # Strips the api-https-proxy part of
     # the url, but forward the rest.
     rewrite  ^/api-https-proxy/(.*) /$1 break;
     proxy_pass https://my-web.page;
}

Is there any way to have this functionality integrated in nginx-rtmp?

Most helpful comment

+1 for https in directives callbacks

All 7 comments

@aleksanb Interesting way to use the on_publish for authentication. How do you block a connection or publisher? with this API?

We send a 'stream-key' as an extra parameter during rtmp connect.
As the nginx-notify module appends all arguments from the original connection to the on_publish, etc methods, the authentication server can then check the received stream-key from the nginx-rtmp server, and deny (return a 4xx response code) if the stream-key doesn't match the one originally provided by our authentication server.

Nginx-rtmp will then drop the connection.

Nice, didn't know that was possible that way.

@luukverhoeven can't belive you :) You better read the Directives wiki page, because this module has a lot features like that and you can do very great things with http requests (notify and control sub-modules).

@aleksanb I think you should stay at your approach, because it's just bullet-proof and "production ready".

+1 for https in directives callbacks

Reading what @aleksanb is doing, I think it is an excellent approach in any case.

needing this as well, any progress??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mattyzero picture Mattyzero  ·  6Comments

SmokE-PGF picture SmokE-PGF  ·  6Comments

evgenibers picture evgenibers  ·  4Comments

ReeseWang picture ReeseWang  ·  3Comments

Tinywan picture Tinywan  ·  3Comments