mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-12 17:37:24 +00: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:
22
shared/networkHosts.js
Normal file
22
shared/networkHosts.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export function isWildcardHost(host) {
|
||||
return host === '0.0.0.0' || host === '::';
|
||||
}
|
||||
|
||||
export function isLoopbackHost(host) {
|
||||
return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '[::1]';
|
||||
}
|
||||
|
||||
export function normalizeLoopbackHost(host) {
|
||||
if (!host) {
|
||||
return host;
|
||||
}
|
||||
return isLoopbackHost(host) ? 'localhost' : host;
|
||||
}
|
||||
|
||||
// Use localhost for connectable loopback and wildcard addresses in browser-facing URLs.
|
||||
export function getConnectableHost(host) {
|
||||
if (!host) {
|
||||
return 'localhost';
|
||||
}
|
||||
return isWildcardHost(host) || isLoopbackHost(host) ? 'localhost' : host;
|
||||
}
|
||||
Reference in New Issue
Block a user