webrtcload-balancingstunturncoturn

Authentication failed when coturn is behind the udp load balancer like nginx


It may be a really simple question because i am a newbie about turn servers. I would like to run coturn server behind a load balancer such as nginx.

My case is:

  1. I have a nginx load balancer on server which is 192.168.1.10. And listening port 3478 for requests. Also this server has public ip address such as 82.222..
  2. I have a turn server (coturn) which is 192.168.1.11. And runing on port 3478 (this server is in the same network with load balancer)
  3. I'm testing my turn server connectivity with this site: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

My problem is: If i do nat port forwarding from my public ip address to coturn server without using load balancer, connectivity test is performing successfully. However, if i use nginx udp load balancing method for redirecting request to my turn server, connectivity test is returning "Authentication Failed" error.

Is there any idea about this issue? Any help about this issue is appreciated.


Solution

  • You have not included any specifics about your nginx configuration, example config files, how you tested, etc. This makes it difficult to help point you at the solution to your problem.

    Note that the coturn TURN server has some documentation about load balancing; it can be found in the wiki on Github: https://github.com/coturn/coturn/wiki/TURN-Performance-and-Load-Balance

    That being said, I must agree with comment from Philipp and say that DNS-based load balancing for TURN servers works very well. This scenario is mentioned briefly in the documentation above.

    Hope this helps, and good luck :)