From 80a4c5f6ad8f2f71a879ec1b2ceb13c591afbd37 Mon Sep 17 00:00:00 2001 From: WinJay Date: Thu, 12 Mar 2026 15:48:21 +0800 Subject: [PATCH] fix(api): use relative baseURL to fix docker deployment API requests This fixes the issue where the frontend in docker tries to connect to localhost instead of the Vite proxy. --- frontend/src/api/index.js | 2 +- frontend/vite.config.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index e2d9465b..60e8e0da 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -2,7 +2,7 @@ import axios from 'axios' // 创建axios实例 const service = axios.create({ - baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5001', + baseURL: import.meta.env.VITE_API_BASE_URL || '', timeout: 300000, // 5分钟超时(本体生成可能需要较长时间) headers: { 'Content-Type': 'application/json' diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 7cec1a71..e9e4aab5 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -6,7 +6,6 @@ export default defineConfig({ plugins: [vue()], server: { port: 3000, - open: true, proxy: { '/api': { target: 'http://localhost:5001',