From 8fa3b6b1a0bb92a3326c8d22f6da590f33a25a1a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 25 Apr 2026 17:10:21 +0200 Subject: [PATCH] nginx: add /websockets plural alias with path rewrite to selkies /ws The selkies-dashboard frontend (selkies-web-core/selkies-ws-core.js) builds its WebSocket-mode connection URL as `${pathname}websockets` (plural), while the bundled nginx config only routes `/websocket` (singular). Browsers therefore see NS_ERROR_WEBSOCKET_CONNECTION_REFUSED on first WebSocket-mode connect. Even when the singular URL is used, the upstream selkies signaling server (process_request in src/selkies/signaling_server.py) only recognises path == "/ws" and paths ending with "/signaling" for the WebSocket upgrade. Anything else falls through to a 404. Add a `SUBFOLDERwebsockets` location with `proxy_pass http://127.0.0.1:CWS/ws`, i.e. plural URL exposed to the client and rewritten to /ws towards selkies. This makes WebSocket-mode work out of the box without any frontend or selkies code changes. Tested with debian-trixie base image, selkies in --mode=websockets and in dual-mode (SELKIES_ENABLE_DUAL_MODE=true): browser connects, dashboard loads, stream renders. --- root/defaults/default.conf | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/root/defaults/default.conf b/root/defaults/default.conf index 2b6258af..af9defbd 100644 --- a/root/defaults/default.conf +++ b/root/defaults/default.conf @@ -38,6 +38,24 @@ server { client_max_body_size 10M; proxy_pass http://127.0.0.1:CWS; } + # Plural alias for /websockets used by selkies-dashboard frontend + # (selkies-ws-core.js builds the URL as `${pathname}websockets`). + # Selkies signaling-server only recognises /ws, hence the path rewrite. + location SUBFOLDERwebsockets { + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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_http_version 1.1; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + proxy_connect_timeout 3600s; + proxy_buffering off; + client_max_body_size 10M; + proxy_pass http://127.0.0.1:CWS/ws; + } location SUBFOLDERfiles { fancyindex on; fancyindex_footer SUBFOLDERnginx/footer.html; @@ -96,6 +114,24 @@ server { client_max_body_size 10M; proxy_pass http://127.0.0.1:CWS; } + # Plural alias for /websockets used by selkies-dashboard frontend + # (selkies-ws-core.js builds the URL as `${pathname}websockets`). + # Selkies signaling-server only recognises /ws, hence the path rewrite. + location SUBFOLDERwebsockets { + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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_http_version 1.1; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + proxy_connect_timeout 3600s; + proxy_buffering off; + client_max_body_size 10M; + proxy_pass http://127.0.0.1:CWS/ws; + } location SUBFOLDERfiles { fancyindex on; fancyindex_footer SUBFOLDERnginx/footer.html;