map $http_upgrade $screener_connection_upgrade { default upgrade; '' close; } server { listen 80; listen [::]:80; server_name share.bonfire.icu; location ^~ /.well-known/acme-challenge/ { root /var/www/letsencrypt; default_type text/plain; } location / { return 301 https://share.bonfire.icu$request_uri; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name share.bonfire.icu; ssl_certificate /etc/letsencrypt/live/share.bonfire.icu/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/share.bonfire.icu/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; access_log /var/log/nginx/screener.access.log; error_log /var/log/nginx/screener.error.log warn; add_header Strict-Transport-Security "max-age=31536000" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "no-referrer" always; add_header X-Frame-Options "DENY" always; add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always; # Optional LiveKit signaling for automatic SFU fallback. Set LIVEKIT_URL to # wss://share.bonfire.icu. Legacy clients use the exact /rtc endpoint. location = /rtc { # The WebSocket query contains a short-lived LiveKit join token. Do not # persist the request target in either access or error logs. access_log off; error_log /dev/null crit; proxy_pass http://127.0.0.1:7880; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $screener_connection_upgrade; proxy_read_timeout 5h; proxy_send_timeout 5h; proxy_buffering off; } # Current clients use versioned paths below /rtc/. location ^~ /rtc/ { # The WebSocket query contains a short-lived LiveKit join token. Do not # persist the request target in either access or error logs. access_log off; error_log /dev/null crit; proxy_pass http://127.0.0.1:7880; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $screener_connection_upgrade; proxy_read_timeout 5h; proxy_send_timeout 5h; proxy_buffering off; } location / { proxy_pass http://127.0.0.1:8787; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto https; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $screener_connection_upgrade; proxy_read_timeout 5h; proxy_send_timeout 5h; proxy_buffering off; } }