Thursday, April 3, 2014

Proxy Protocol support in nginx-rtmp-module 1.1.4

The new version of nginx-rtmp-module has proxy protocol support added. Proxy protocol lets you put nginx behind a TCP-proxy and still have real client address. Here's an example of nginx.conf setting a listener with proxy protocol enabled.
rtmp {
    server {
        listen 1935; # usual listener
        listen 1936 proxy_protocol; # handles proxy protocol
        
        application myapp {
            live on;
        }
    }
}
If proxy_protocol option is specified in listen directive, such listener expects proxy protocol header from its client before RTMP data and will not handle plain RTMP requests. The client address received via proxy protocol is used everywhere instead of the proxy address including logs and on_XXX callbacks.

Notable software having client-side proxy protocol support allowing you to proxy RTMP requests to nginx-rtmp-module:

6 comments:

  1. Dear Mr Arutyunyan,

    When I use your nginx configuration for video on demand (vod) correctly, I cannot seem to open mp4 files (haven't tested flv) when they are not in the app specified file path.

    For example

    rtmp {
    server {
    listen 1935;
    chunk_size 4000;
    application vod {
    play /videos/mp4s ;
    }
    }
    }

    Lets me open the identical files /videos/mp4s/sample1.mp4 but not /videos/mp4s/subdirectory/sample1.mp4

    Also when I successfully open a mp4 rtmp stream using VLC player via the url: rtmp://mydomain.com:1935/vod/sample1.mp4 it plays, but it does not let me seek. When I open the same file via http:// protocol, it plays and seeks fine.

    It would be very very pleasant if you could enlighten me with a solution.

    ReplyDelete
  2. This essay is very attractive and useful. Your this work defiantly helps other.
    New Album Releases UK proxy

    ReplyDelete
  3. Hi, Roman,
    I really like to keep up with this blog. But after google reader shutdown, there are no good rss reader to use. Could you please open the option "share after posting" on the Google+ tab of blogger setting page. So people followed you on G+ get notified when you publish a new post.

    ReplyDelete
  4. I think you made awesome decision the moment when you choose this topic of the blog article here. Very usefull informatiom.
    Mp3Juices UK proxy
    .

    ReplyDelete
  5. Is it possible to use HDFVR recorder with nginx-rtmp?

    ReplyDelete