I am trying to use webrtc inside of a difficult network that blocks all ports but 80 and 443 outbound and everything inbound. So I need a coturn server running to listen to 80 and 443 with SSL certs. I would like to run that alongside a REST API server, some websocket servers, and NGINX hosting static files. I am starting from this working nginx config. There is an example in another so question on how to forward on the root. But I wasn't able to get the same thing to work with a path. For example, I would like the turn server to work on <url>/coturn
. I would prefer the ssl be handled by nginx but it is fine if that job gets passed to coturn.
Can anyone show me a nginx config that handles coturn with multiple other endpoints like this?
Edit: Here is a very minimal config, just trying to get the proxying to work similarly to this:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream{
upstream turn_secure{
server coturn:5349;
}
upstream turn{
server coturn:3478;
}
server{
listen 3478;
proxy_pass turn;
}
server{
listen 3478 udp;
proxy_pass turn;
}
server{
listen 5349;
proxy_pass turn_secure;
}
server{
listen 5349 udp;
proxy_pass turn_secure;
}
}
The domain references are given by the docker-compose that I have running.
But running this through trickleice, I get a non-reachable error. If I instead run coturn exposed to the internet then it seems to work as expected.