WebSocket upgrades not tunneled on domain-routed (Host-based) requests #59

Open
opened 2026-06-04 13:13:49 +00:00 by mik-tf · 0 comments
Owner

dispatch_domain_route (the Host-based routing path that every per-tenant domain uses) forwards requests with the plain HTTP forwarders, which finish the request and response but never wire up the socket after a 101 Switching Protocols, so browser WebSocket connections through a tenant domain reconnect-loop even though normal pages load fine. The is_ws_upgrade short-circuit only existed in the path-prefix handler. I fixed this on main in 1ab1406 by adding the same short-circuit to dispatch_domain_route for http and https targets (reusing forward_ws_to_upstream, which now takes a strip_prefix argument so it matches forward_to_upstream). Verified live: the assistant chat now streams through the gateway on a tenant domain. Heads up that development still has the bug and needs the same change or a forward-merge of main, and that socket-target domain routes still have no Unix-socket WebSocket tunnel (none use a socket target for WebSocket traffic today). cc @sameh-farouk

`dispatch_domain_route` (the Host-based routing path that every per-tenant domain uses) forwards requests with the plain HTTP forwarders, which finish the request and response but never wire up the socket after a 101 Switching Protocols, so browser WebSocket connections through a tenant domain reconnect-loop even though normal pages load fine. The `is_ws_upgrade` short-circuit only existed in the path-prefix handler. I fixed this on `main` in [1ab1406](https://forge.ourworld.tf/lhumina_code/hero_proxy/commit/1ab1406aec24e890e5d2d9daf9a728050cddac46) by adding the same short-circuit to `dispatch_domain_route` for http and https targets (reusing `forward_ws_to_upstream`, which now takes a `strip_prefix` argument so it matches `forward_to_upstream`). Verified live: the assistant chat now streams through the gateway on a tenant domain. Heads up that `development` still has the bug and needs the same change or a forward-merge of `main`, and that socket-target domain routes still have no Unix-socket WebSocket tunnel (none use a socket target for WebSocket traffic today). cc @sameh-farouk
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_proxy#59
No description provided.