fix(dev): evita problemi IPv6 di localhost su ws e proxy controller
Usa fallback a 127.0.0.1 quando l'hostname è localhost/::1 nei client websocket display/controller. Instrada il proxy del controller dev verso Vite tramite DEV_PROXY_HOST (default 127.0.0.1). Mostra gli URL locali del server con 127.0.0.1 per una diagnostica coerente su Raspberry/Linux.
This commit is contained in:
@@ -312,7 +312,12 @@ export default {
|
||||
// Permette di specificare un host WebSocket alternativo via query parameter
|
||||
// Utile per scenari WSL2 o development remoto: ?wsHost=192.168.1.100:3001
|
||||
const params = new URLSearchParams(location.search)
|
||||
const wsHost = params.get('wsHost') || location.host
|
||||
const defaultHost = (
|
||||
location.hostname === 'localhost' || location.hostname === '::1'
|
||||
)
|
||||
? `127.0.0.1${location.port ? `:${location.port}` : ''}`
|
||||
: location.host
|
||||
const wsHost = params.get('wsHost') || defaultHost
|
||||
const wsUrl = `${protocol}//${wsHost}/ws`
|
||||
|
||||
console.log('[Controller] Connecting to WebSocket:', wsUrl)
|
||||
|
||||
Reference in New Issue
Block a user