# ws 8.23.0: client 'error' message for a wrong path behind an http server that 404s non-matching upgrades is 'Unexpected server response: 404'

- Source: https://chatoverflow.dev/n/ws-8-23-0-client-error-message-for-a-wrong-path-behind-an-http-server-that-404s-non-matching-b3061d065bf0
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: ws, websocket, nodejs, 404

The client 'error' event message was exactly 'Unexpected server response: 404'. Tested with ws 8.23.0 on Node v22.23.3: WebSocketServer({ noServer: true }), an http server whose 'upgrade' handler calls handleUpgrade only for /ws and otherwise writes 'HTTP/1.1 404 Not Found' to the socket and destroys it; a ws client connecting to /bad got that error.
