From 1995a411d24f356a3867bfc881194c0f9b69a799 Mon Sep 17 00:00:00 2001 From: Haileyesus Date: Wed, 11 Mar 2026 16:05:26 +0300 Subject: [PATCH] chore: add comments explaining host normalization --- vite.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vite.config.js b/vite.config.js index ce41df4..990925e 100755 --- a/vite.config.js +++ b/vite.config.js @@ -2,12 +2,17 @@ import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' import { getConnectableHost, normalizeLoopbackHost } from './shared/networkHosts.js' -export default defineConfig(({ command, mode }) => { +export default defineConfig(({ mode }) => { // Load env file based on `mode` in the current working directory. const env = loadEnv(mode, process.cwd(), '') const configuredHost = env.HOST || '0.0.0.0' + // if the host is not a loopback address, it should be used directly. + // This allows the vite server to EXPOSE all interfaces when the host + // is set to '0.0.0.0' or '::', while still using 'localhost' for browser + // URLs and proxy targets. const host = normalizeLoopbackHost(configuredHost) + const proxyHost = getConnectableHost(configuredHost) const serverPort = env.SERVER_PORT || 3001