From 511e098c9097f721f55b396aca8dc9bcfcea873c Mon Sep 17 00:00:00 2001 From: Calvin Secrest Date: Sun, 31 Aug 2025 22:55:54 -0400 Subject: [PATCH] fix: avoid hardcoded localhost URLs --- backend/server.js | 2 +- frontend/chat-ui/vite.config.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/server.js b/backend/server.js index f183f6b..1c2e79d 100644 --- a/backend/server.js +++ b/backend/server.js @@ -37,7 +37,7 @@ const allowedOrigins = process.env.ALLOWED_ORIGINS : ['https://www.ntari.org']; if (process.env.NODE_ENV !== 'production') { - allowedOrigins.push('http://localhost:3000'); + allowedOrigins.push('http://127.0.0.1:3000'); } app.use(cors({ diff --git a/frontend/chat-ui/vite.config.js b/frontend/chat-ui/vite.config.js index 535ba96..5ff8e22 100644 --- a/frontend/chat-ui/vite.config.js +++ b/frontend/chat-ui/vite.config.js @@ -1,21 +1,23 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +const BACKEND_URL = process.env.BACKEND_URL || 'http://127.0.0.1:5000'; + export default defineConfig({ plugins: [react()], server: { port: 3000, proxy: { '/api': { - target: 'http://localhost:5000', + target: BACKEND_URL, changeOrigin: true }, '/conversations': { - target: 'http://localhost:5000', + target: BACKEND_URL, changeOrigin: true }, '/messages': { - target: 'http://localhost:5000', + target: BACKEND_URL, changeOrigin: true } }