fix: 使用127.0.0.1替代localhost以确保IPv4连接,避免IPv6解析问题

This commit is contained in:
catlog22
2026-03-06 11:43:14 +08:00
parent 33cc451b61
commit 88149b6154
3 changed files with 5 additions and 4 deletions

View File

@@ -14,7 +14,8 @@ const basePath = process.env.VITE_BASE_URL || '/'
// Backend target for Vite proxy (used when directly opening the Vite dev server port).
// In `ccw view`, this is set to the dashboard server port so /api and /ws route correctly.
const backendHost = process.env.VITE_BACKEND_HOST || 'localhost'
// Use 127.0.0.1 instead of localhost to ensure IPv4 connection (avoid IPv6 resolution issues)
const backendHost = process.env.VITE_BACKEND_HOST || '127.0.0.1'
const backendPort = Number(process.env.VITE_BACKEND_PORT || '3456')
const backendHttpTarget = `http://${backendHost}:${backendPort}`
const backendWsTarget = `ws://${backendHost}:${backendPort}`