From dc1b2ab99b22bc0139c4b375922b91f2dd24b239 Mon Sep 17 00:00:00 2001 From: Perplexity Bot Date: Mon, 3 Aug 2026 22:40:24 +0000 Subject: [PATCH] Fix frontend API: use relative /api with Vite proxy to agent --- frontend/src/lib/api.ts | 2 +- frontend/vite.config.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 frontend/vite.config.ts diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index c550667..70a4cbd 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -1,6 +1,6 @@ import type { NetObject, ServiceInfo } from '../types'; -const AGENT_BASE = 'http://127.0.0.1:8001'; +const AGENT_BASE = '/api'; export async function fetchObjects(): Promise { return [ diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts new file mode 100644 index 0000000..22b8102 --- /dev/null +++ b/frontend/vite.config.ts @@ -0,0 +1,16 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +export default defineConfig({ + plugins: [react()], + server: { + host: '0.0.0.0', + port: 5173, + proxy: { + '/api': { + target: 'http://127.0.0.1:8001', + changeOrigin: true, + }, + }, + }, +});