nginx: add /websockets plural alias with path rewrite to selkies /ws#151
nginx: add /websockets plural alias with path rewrite to selkies /ws#151DL6ER wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
Thanks for opening this pull request! Be sure to follow the pull request template!
There was a problem hiding this comment.
Pull request overview
This PR updates the bundled nginx default config to support the selkies-dashboard frontend’s WebSocket URL convention by adding a plural /websockets location that proxies to Selkies’ /ws endpoint.
Changes:
- Add
location SUBFOLDERwebsocketsto proxy WebSocket upgrades tohttp://127.0.0.1:CWS/ws. - Apply the same change to both nginx server blocks (ports
3000and3001).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I am a bot, here are the test results for this PR:
|
|
Linking #154 (comment) |
|
This pull request has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
Description:
Add an
nginxlocation block for the plural/websocketsURL that the selkies-dashboard frontend builds in WebSocket mode, with a path rewrite to selkies'/wsendpoint.Done in both the
:3000and the:3001server blocks ofroot/defaults/default.conf.Benefits of this PR and context:
Out of the box, opening a freshly started
lscr.io/linuxserver/baseimage-selkies-derived container in a browser logs:Three independent path conventions are in play:
addons/selkies-web-core/selkies-ws-core.jsupstream) builds the URL as${ws_protocol}${window.location.host}${pathname}websockets(plural).location SUBFOLDERwebsocket {}(singular).src/selkies/signaling_server.pyupgrades to WebSocket only forpath == "/ws"or paths ending in/signaling.So even a singular
/websocketrequest would 404 inside selkies.The proposed change makes the default install work end-to-end without patching either the frontend or selkies, by exposing the URL the frontend already uses and rewriting it to the path the server expects. The existing singular
/websocketlocation is left untouched for backwards compatibility with anything that may already point at it.How Has This Been Tested?
Built locally from this branch on top of the upstream
master(debian-trixievariant), then composed a webtop-style layer on top (debian-xfce) and ran it on a Linux x86_64 host with:Validated in Firefox 149 and Chromium 142 on Ubuntu:
NS_ERROR_WEBSOCKET_CONNECTION_REFUSEDonwss://<host>/websockets, dashboard fails to load.HTTP/1.1 101 Switching Protocols, dashboard connects, MATE/XFCE desktop renders, input round-trip works.Also verified directly:
Source / References:
addons/selkies-web-core/selkies-ws-core.jsupstream ofselkies-project/selkies, the linewebsocketEndpointURL.pathname += 'websockets'.src/selkies/signaling_server.pyupstream, theprocess_requestmethod that returnsNone(i.e. accepts WS upgrade) only for/ws,/ws/,/signalingand/signaling/.