mirror of
https://github.com/ruvnet/RuView.git
synced 2026-04-26 13:10:40 +00:00
fix(ui): WebSocket protocol matches page protocol, not hostname (#272)
buildWsUrl() forced wss:// on non-localhost HTTP connections, breaking LAN/Docker deployments at http://192.168.x.x:3000. Now simply: https → wss, http → ws. Closes #272 Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
7eba8c7286
commit
578d84c25e
1 changed files with 4 additions and 4 deletions
|
|
@ -113,11 +113,11 @@ export function buildApiUrl(endpoint, params = {}) {
|
|||
|
||||
// Helper function to build WebSocket URLs
|
||||
export function buildWsUrl(endpoint, params = {}) {
|
||||
// Use secure WebSocket (wss://) when serving over HTTPS or on non-localhost
|
||||
// Use ws:// only for localhost development
|
||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
|
||||
// Match WebSocket protocol to page protocol: https → wss, http → ws.
|
||||
// Previous logic forced wss:// on non-localhost HTTP, breaking LAN/Docker
|
||||
// deployments served over plain HTTP. See issue #272.
|
||||
const isSecure = window.location.protocol === 'https:';
|
||||
const protocol = (isSecure || !isLocalhost)
|
||||
const protocol = isSecure
|
||||
? API_CONFIG.WSS_PREFIX
|
||||
: API_CONFIG.WS_PREFIX;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue