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:

9 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. 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
  3. 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
  4. Is it possible to use HDFVR recorder with nginx-rtmp?

    ReplyDelete
  5. I have configured nginx-rtmp and able to stream the video. Now I am setting HAProxy to point to nginx-rtmp server but could not make it work. I have included the

    "listen 1936 proxy_protocol" in my nginx.conf



    I followed this configuration taken from
    http://blog.haproxy.com/2012/09/21/high-available-rtmp-platform-with-haproxy-and-crtmpserver/
    ###################
    frontend ft_rtpm
    bind 10.1.31.1 name rtmp
    mode tcp
    maxconn 600
    default_backend bk_rtmp

    backend bk_rtmp
    mode tcp
    balance roundrobin
    stick store-request src
    stick-table type ip size 200k expire 20m
    stick on src
    source 0.0.0.0 usesrc clientip
    server media01 10.0.0.1:1936 check maxconn 200 weight 10
    server media02 10.0.0.2:1936 check maxconn 200 weight 10
    ###################


    Am I missing something?

    ReplyDelete
  6. I have configured nginx-rtmp and able to stream the video. Now I am setting HAProxy to point to nginx-rtmp server but could not make it work. I have included the

    "listen 1936 proxy_protocol" in my nginx.conf



    I followed this configuration taken from
    http://blog.haproxy.com/2012/09/21/high-available-rtmp-platform-with-haproxy-and-crtmpserver/
    ###################
    frontend ft_rtpm
    bind 10.1.31.1 name rtmp
    mode tcp
    maxconn 600
    default_backend bk_rtmp

    backend bk_rtmp
    mode tcp
    balance roundrobin
    stick store-request src
    stick-table type ip size 200k expire 20m
    stick on src
    source 0.0.0.0 usesrc clientip
    server media01 10.0.0.1:1936 check maxconn 200 weight 10
    server media02 10.0.0.2:1936 check maxconn 200 weight 10
    ###################


    Am I missing something?

    ReplyDelete
  7. In this manner my pal Wesley Virgin's autobiography launches in this shocking and controversial video.

    You see, Wesley was in the military-and shortly after leaving-he unveiled hidden, "MIND CONTROL" tactics that the government and others used to get anything they want.

    These are the same methods lots of famous people (notably those who "became famous out of nowhere") and top business people used to become wealthy and famous.

    You probably know that you utilize only 10% of your brain.

    That's because the majority of your brainpower is UNTAPPED.

    Perhaps that expression has even occurred INSIDE your very own head... as it did in my good friend Wesley Virgin's head seven years back, while driving a non-registered, trash bucket of a car without a driver's license and with $3.20 on his banking card.

    "I'm absolutely fed up with living check to check! When will I finally make it?"

    You've taken part in those types of questions, right?

    Your own success story is waiting to happen. You just have to take a leap of faith in YOURSELF.

    UNLOCK YOUR SECRET BRAINPOWER

    ReplyDelete