mirror of
https://github.com/handsomezhuzhu/QQuiz.git
synced 2026-02-20 20:10:14 +00:00
fix: 修复服务器部署时前端无法连接后端的问题
- 将 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 <noreply@anthropic.com>
This commit is contained in:
@@ -48,7 +48,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
- VITE_API_URL=http://localhost:8000
|
- VITE_API_URL=/api
|
||||||
|
- REACT_APP_API_URL=http://backend:8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
command: npm start
|
command: npm start
|
||||||
|
|||||||
Reference in New Issue
Block a user