docs: fix Apache websocket rewrite for /api/ws (#717)

The Apache example forwarded websocket upgrades with
`RewriteRule /ws(.*) "ws://localhost:8080/ws$1"`. The pattern is not
anchored, so `/api/ws` matches it too and is rewritten to `/ws`, the
legacy endpoint. The 3.2 client connects to `/api/ws?token=...`; through
this rule the legacy handler sees no username/password, logs in with
empty credentials and answers `system/disconnect` ("couldn't create a
new session: error response from backend: Unauthorized"), while the
server logs `invalid password` from the legacy proxy.

Forward every websocket upgrade to the same path instead. Verified with
httpd:2.4 in front of ghcr.io/m1k1o/neko/firefox:3.2.0: the old rule
reproduces the error, the new one connects the 3.2 client and still
serves legacy `/ws` clients.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
SamAcctX
2026-10-16 14:43:34 -05:00
committed by GitHub
parent 21ad64423f
commit 5f40eb9388
+2 -1
View File
@@ -79,7 +79,8 @@ Bear in mind that your Neko server does not have to run on the same computer as
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule /ws(.*) "ws://localhost:8080/ws$1" [P,L]
# forward every websocket upgrade to the same path (the client connects to /api/ws)
RewriteRule ^/(.*) "ws://localhost:8080/$1" [P,L]
# Available log levels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.