cloudflared icon indicating copy to clipboard operation
cloudflared copied to clipboard

Tunneling rtmp

Open mananchawla2005 opened this issue 2 years ago • 19 comments

Hi, I used cloudflare tunnels and it seemed to be fun. I was wondering if we could tunnel rtmp traffic as well? I searched for this on the internet but was not able to find a working solution.

mananchawla2005 avatar Oct 26 '21 09:10 mananchawla2005

Hi @mananchawla2005 - what's the application of interest? If it's using RTMP over TCP we'd expect this to be supported by default.

If it happens to use RTMP over UDP, stay tuned.

abelinkinbio avatar Oct 26 '21 12:10 abelinkinbio

@abelinkinbio Hey thanks for replying. Yea its rtmp over tcp. Can u give an idea on how that would work? I am little new to cloudflare tunnels. Thanks in advance!

mananchawla2005 avatar Oct 26 '21 13:10 mananchawla2005

@mananchawla2005 no problem at all! It'll depend a little on what you're hoping to accomplish. What's the application and what are you aiming to use Tunnel for?

abelinkinbio avatar Oct 26 '21 13:10 abelinkinbio

@abelinkinbio So I wanted to host a rtmp server but to share that rtmp server publically so that someone can use that rtmp url and put it in obs for example. I wanted to use cloudflare tunnels as doing so without the tunnels takes a lot of effort and time. + u need a dedicated ip address for rtmp to expose publically which I dont have.

mananchawla2005 avatar Oct 26 '21 15:10 mananchawla2005

I'd start with our onboarding guide in the Cloudflare for Teams dashboard:

  • https://dash.teams.cloudflare.com/access/tunnels

If you haven't created a Tunnel for your Teams account yet, it should guide you through the process of creating your tunnel, routing your tunnel, mapping your configuration file, and running.

abelinkinbio avatar Oct 26 '21 21:10 abelinkinbio

Hi, @abelinkinbio thanks for the reply. Actually I dont have a teams account because it requires a credit/debit card and As I am a sill a student, I dont have any of those. Is there any way to do it directly from cloudflared command?

mananchawla2005 avatar Oct 27 '21 06:10 mananchawla2005

@mananchawla2005 no problem at all, you should still be able to accomplish everything you're looking to do with only a Cloudflare account on the Free plan (no CC required). This will allow you to add a domain and create your first tunnel.

The guide I was referring to in the Teams dashboard is very similar to our set-up guide in dev docs which should help you get started.

This guide will walk you through the five steps below:

  1. install cloudflared on your origin
  2. authenticate cloudflared against your account
  3. create a tunnel - this gives your tunnel a friendly name
  4. route a tunnel - this points traffic towards your tunnel
  5. create a config.yaml - this serves as the operating manual for your tunnel
  6. run a tunnel - this starts proxying traffic to your origin

abelinkinbio avatar Oct 27 '21 12:10 abelinkinbio

Hi @mananchawla2005,

I can confirm RTMP over cloudflare tunnel works. But, it doesn't mean that it can publish directly to twitch/youtube/etc, you need to have your own RTMP server setup (ex. nginx-rtmp module), for it to work.

So instead of publishing RTMP from your client ISP <-> public internet <-> RTMP server, it will go through ISP <-> cloudflare <-> RTMP server.

Is that what you want?

gvccvwangmingn2 avatar Oct 27 '21 19:10 gvccvwangmingn2

@abelinkinbio Thanks alot!

mananchawla2005 avatar Oct 27 '21 21:10 mananchawla2005

@gvccvwangmingn2 No i dont want to publish it to youtube, instead what I want is, rtmp server running on my machine/server, then the cloudflare tunnel which creates a tcp tunnel on my custom domain for example. Now someone can use obs to connect to rtmp://mydomain.com which will be a cloudflare tunnel and send the traffic to the server.

mananchawla2005 avatar Oct 27 '21 21:10 mananchawla2005

Hi, I also need to enable the rtmp port to allow for live streaming on my peertube server, here the config I'm trying

 tunnel: <id>
credentials-file: /home/<user>/.cloudflared/<id>.json
ingress:
...
  - hostname: tube.server.net
    service: https://tube.server.net
    originServerName: tube.server.net
  - hostname: stream.tube.server.net
    service: rtmp://tube.server.net:1935
  - service: http_status:404

But this does not work, rtmpdump just times out as if the rule isn't even there. I don't get what I am doing wrong. I have tube.server.net set as localhost in my machine, so it should work since running

rtmpdump -r rtmp://tube.server.net:1935/live/garbage

does work on my machine

@mananchawla2005 Did you manage to do it?

vrisalab avatar Dec 23 '21 22:12 vrisalab

@vrisalab any errors from cloudflared client side? you cannot push rtmp directly to stream.tube.server.net

gvccvwangmingn2 avatar Dec 24 '21 04:12 gvccvwangmingn2

@gvccvwangmingn2 No errors on the cloudflared service logs. Is there any way to be able to do what I want?

vrisalab avatar Dec 24 '21 04:12 vrisalab

I'm trying to achieve this as well.. are we able to proxy a running RTMP server behind the Argo tunnel to our domain via subdomain? I thought it was against ToS to run anything other than HTTP and HTTPS through.

Milssss avatar Feb 23 '22 20:02 Milssss

+1 to this issue, not able to a get a stream running.

leetfin avatar Oct 14 '22 02:10 leetfin

+1

Will the RTMP protocol ever be supported by Cloudflared? Or is there some kind of workaround?

jorbig avatar Oct 15 '22 22:10 jorbig

https://github.com/cloudflare/cloudflared/issues/14

lvnilesh avatar Jan 21 '23 22:01 lvnilesh

It has been four years, that response is no longer necessarily accurate.

leetfin avatar Jan 22 '23 06:01 leetfin

I agree with @leetfin. A protocol like RDP is supported as well, but that also doesn't run over HTTP, right?

jorbig avatar Jan 22 '23 07:01 jorbig