winshining / nginx-http-flv-module

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.
BSD 2-Clause "Simplified" License
2.71k stars 567 forks source link

Dynamic proxy pass #254

Open dcarrion87 opened 7 months ago

dcarrion87 commented 7 months ago

Looking to use this for multiple source / destination.

RTMP clients would come into this server and on_connect will look up and rewrite to the "live" application.

I'd expect there to only be one "live" application and be able to dynamically proxy pass to many different backends based on the value in the original /.

Is this possible without setting up unique application handlers?

I'd rather not have to use notify_send_redirect and have the client needing to support this.

golyalpha commented 3 months ago

You'd do this in the on_publish directive:

HTTP 3xx redirects RTMP to another stream whose name is taken from Location HTTP response header. If new stream name is started with rtmp:// then remote relay is created instead. Relays require that IP address is specified instead of domain name and only work with nginx versions greater than 1.3.10. See also notify_relay_redirect.

In other words, you can send rtmp://ip/app/key from the on_publish handler to dynamically create a remote relay rather than a redirect.