diff --git a/backend/tls_localhost_nginx.conf b/backend/dev_nginx.conf similarity index 53% rename from backend/tls_localhost_nginx.conf rename to backend/dev_nginx.conf index 2a593210..e4d665d6 100644 --- a/backend/tls_localhost_nginx.conf +++ b/backend/dev_nginx.conf @@ -16,9 +16,9 @@ server { # currently rely for local development environment on deprecated config.json # setting for livekit_service_url location /.well-known/matrix/client { - return 200 '{"m.homeserver": {"base_url": "http://synapse.localhost:8008"}, "org.matrix.msc4143.rtc_foci": [{"type": "livekit", "livekit_service_url": "http://localhost:8080"}]}'; - default_type application/json; add_header Access-Control-Allow-Origin *; + return 200 '{"m.homeserver": {"base_url": "http://synapse.localhost:8008"}, "org.matrix.msc4143.rtc_foci": [{"type": "livekit", "livekit_service_url": "http://matrix-rtc.localhost:8008/livekit/jwt"}]}'; + default_type application/json; } # Reverse proxy for Matrix Synapse Homeserver @@ -38,3 +38,48 @@ server { error_page 500 502 503 504 /50x.html; } + +server { + listen 80; + listen [::]:80; + listen 443 ssl; + listen 8448 ssl; + listen [::]:443 ssl; + listen [::]:8448 ssl; + server_name matrix-rtc.localhost; + ssl_certificate /root/ssl/cert.pem; + ssl_certificate_key /root/ssl/key.pem; + + + location ^~ /livekit/jwt/ { + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # JWT Service running at port 8080 + proxy_pass http://auth-server:8080/; + } + + location ^~ /livekit/sfu/ { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_send_timeout 120; + proxy_read_timeout 120; + proxy_buffering off; + + proxy_set_header Accept-Encoding gzip; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # LiveKit SFU websocket connection running at port 7880 + proxy_pass http://livekit-sfu:7880/; + } + + error_page 500 502 503 504 /50x.html; + +}