mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-11 00:06:00 +08:00
fix: use shared network hosts configuration for better proxy setup
- Normalize all localhost variants to 'localhost' for consistent proxy configuration in Vite and server setup. - use one source of truth for network hosts functions by moving them to a shared - log production and development urls
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { getConnectableHost, normalizeLoopbackHost } from './shared/networkHosts.js'
|
||||
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
// Load env file based on `mode` in the current working directory.
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
const host = env.HOST || '0.0.0.0'
|
||||
// When binding to all interfaces (0.0.0.0), proxy should connect to localhost
|
||||
// Otherwise, proxy to the specific host the backend is bound to
|
||||
const proxyHost = host === '0.0.0.0' ? 'localhost' : host
|
||||
const configuredHost = env.HOST || '0.0.0.0'
|
||||
const host = normalizeLoopbackHost(configuredHost)
|
||||
const proxyHost = getConnectableHost(configuredHost)
|
||||
const port = env.PORT || 3001
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user