From eeccabf486e67bff214641598341d316a3b5b42f Mon Sep 17 00:00:00 2001 From: handsomezhuzhu <2658601135@qq.com> Date: Tue, 2 Dec 2025 00:19:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E9=83=A8=E7=BD=B2=E6=97=B6=E5=89=8D=E7=AB=AF=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=BF=9E=E6=8E=A5=E5=90=8E=E7=AB=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 VITE_API_URL 从 http://localhost:8000 改为相对路径 /api - 添加 REACT_APP_API_URL 配置用于 Vite 代理转发 - 解决浏览器访问时 localhost 指向用户电脑而非服务器的问题 - 前端请求现在通过 Vite 代理转发到 backend 容器 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 76c1d75..4422b0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,7 +48,8 @@ services: ports: - "3000:3000" environment: - - VITE_API_URL=http://localhost:8000 + - VITE_API_URL=/api + - REACT_APP_API_URL=http://backend:8000 depends_on: - backend command: npm start