diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 5e33c63c529..0558b7e89b0 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -198,6 +198,7 @@ export async function getAllChatFlow(): Promise { export async function start(): Promise { serverApp = new App() + const host = process.env.HOST const port = parseInt(process.env.PORT || '', 10) || 3000 const server = http.createServer(serverApp.app) @@ -208,8 +209,8 @@ export async function start(): Promise { await serverApp.initDatabase() await serverApp.config(io) - server.listen(port, () => { - logger.info(`⚡️ [server]: Flowise Server is listening at ${port}`) + server.listen(port, host, () => { + logger.info(`⚡️ [server]: Flowise Server is listening at ${host ? 'http://' + host : ''}:${port}`) }) } diff --git a/packages/ui/vite.config.js b/packages/ui/vite.config.js index d67fe4432cc..346d605686e 100644 --- a/packages/ui/vite.config.js +++ b/packages/ui/vite.config.js @@ -6,15 +6,17 @@ import dotenv from 'dotenv' export default defineConfig(async ({ mode }) => { let proxy = undefined if (mode === 'development') { - const serverPort = parseInt(dotenv.config({ processEnv: {}, path: '../server/.env' }).parsed?.['PORT']) + const serverEnv = dotenv.config({ processEnv: {}, path: '../server/.env' }).parsed + const serverHost = serverEnv?.['HOST'] ?? 'localhost' + const serverPort = parseInt(serverEnv?.['PORT'] ?? 3000) if (!Number.isNaN(serverPort) && serverPort > 0 && serverPort < 65535) { proxy = { '/api': { - target: `http://localhost:${serverPort}`, + target: `http://${serverHost}:${serverPort}`, changeOrigin: true }, '/socket.io': { - target: `http://localhost:${serverPort}`, + target: `http://${serverHost}:${serverPort}`, changeOrigin: true } }