server { listen 80; server_name _; # Docker's embedded DNS (127.0.0.11). Without this, nginx resolves # upstreams once at startup and breaks the moment a peer container is # recreated with a new bridge IP. The `valid=10s` plus a variable in # proxy_pass forces per-request re-resolution. resolver 127.0.0.11 valid=10s ipv6=off; # Serve the Janus demo HTML/JS extracted from the canyan image. root /usr/share/nginx/html; index index.html; # Janus HTTP API — same origin as the demo pages so the default # settings.js URL ("http://:8088/janus") just works. Regex so # /janus and /janus//... proxy, but /janus.js still hits # the static file root. location ~ ^/janus(/|$) { # Variable upstream + the resolver above = re-DNS on each request. # Plain `proxy_pass http://sip-web-janus:8088` would cache the IP # for the lifetime of the worker process. set $janus_upstream sip-web-janus; proxy_pass http://$janus_upstream:8088; proxy_http_version 1.1; proxy_buffering off; proxy_read_timeout 120s; } location / { try_files $uri $uri/ =404; } }