cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
9.26k stars 821 forks source link

Tunneling rtmp #497

Open mananchawla2005 opened 3 years ago

mananchawla2005 commented 3 years ago

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.

abelinkinbio commented 3 years ago

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.

mananchawla2005 commented 3 years ago

@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!

abelinkinbio commented 3 years ago

@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?

mananchawla2005 commented 3 years ago

@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.

abelinkinbio commented 3 years ago

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

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.

mananchawla2005 commented 3 years ago

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?

abelinkinbio commented 3 years ago

@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
gvccvwangmingn2 commented 3 years ago

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?

mananchawla2005 commented 3 years ago

@abelinkinbio Thanks alot!

mananchawla2005 commented 3 years ago

@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.

vrisalab commented 2 years ago

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?

gvccvwangmingn2 commented 2 years ago

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

vrisalab commented 2 years ago

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

Milssss commented 2 years ago

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.

leetfin commented 2 years ago

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

jorbig commented 2 years ago

+1

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

lvnilesh commented 1 year ago

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

leetfin commented 1 year ago

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

jorbig commented 1 year ago

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

itsdoublearon commented 2 months ago

Bump for 2024 - Any progress on this? Because it would be extremely helpful. Thanks.