I am Implementing webrtc for streaming and I planned to use mediasoup as media server and nginx to handle user request
Not sure anyone will be able to help you as the question is too vague. Are you trying to use nginx as a reverse proxy?
yes, am trying to use nginx as reverse proxy, and load balance
Please, read the documentation of mediasoup before doing random questions. You will be surprised when you realized that mediasoup is not (and does not include) any HTTP or WebSocket server.
Don’t do it and don’t do it!
It’s costly, and it mangles the living hell out of your code and potential to balance correctly. It does not protect against DOS attacks or anything of the sort, good code and good handling is all you need for the media-servers.
Now we have it. worker.createWebRtcServer().
So I am planning to create a mediasoup server with four core - means four worker - means four port → proxy by nginx → proxyed by cloudflare → subdomain.example.com.
But I found some problems,
- Cloudflare don’t give port for free. Although each subdomain have a free 443 port.
And I don’t want my server’s IP became publically accessible.
- Don’t know how to route client to worker1 every time. Nginx try to load balance and may send traffic to another worker. Maybe header info might help.
Need help on this.
The main problem is to get RTP traffic through the proxies. Try it with just one worker, to not waste too much time in case the idea doesn’t work at all.