map $http_upgrade $screener_connection_upgrade { default upgrade; '' close; } limit_req_zone $binary_remote_addr zone=screener_host_admission:10m rate=5r/m; 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; # Reject the unversioned fallback endpoint that pinned livekit-client@2.22.0 # can still try. Keep it out of logs because the URL may contain a join token. location = /rtc { access_log off; error_log /dev/null crit; return 404; } # Pinned livekit-client@2.22.0 still tries this v0 endpoint after a # ServiceNotFound response. Reject that fallback with a no-log 404; # /rtc/v1* below is the accepted SDK path. location = /rtc/validate { access_log off; error_log /dev/null crit; return 404; } # This integration accepts only the v1 path. Set LIVEKIT_URL to # wss://share.bonfire.icu. location ^~ /rtc/v1 { # 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; } # Reject any other retired or unknown LiveKit path without logging tokens. location ^~ /rtc/ { access_log off; error_log /dev/null crit; return 404; } location = /api/host-admission { limit_req zone=screener_host_admission burst=5 nodelay; limit_req_status 429; 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_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; } }