hotfix: 修复生产前端 API 默认地址
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
- 后端 API:`http://localhost:8000/api/v1/*`
|
- 后端 API:`http://localhost:8000/api/v1/*`
|
||||||
- 生产环境建议通过外部反向代理提供同域访问,前端代码默认请求同域 `/api/v1/*`
|
- 生产环境建议通过外部反向代理提供同域访问,前端代码默认请求同域 `/api/v1/*`
|
||||||
- 如果本地直接访问 `http://localhost:4173`,可在 `frontend/.env` 中设置 `VITE_API_BASE_URL=http://localhost:8000`,让前端直连后端 API
|
- 如果本地直接访问 `http://localhost:4173`,可在 `frontend/.env` 中设置 `VITE_API_BASE_URL=http://localhost:8000`,让前端直连后端 API
|
||||||
- `docker compose` 本地构建前端容器时,默认会把 `VITE_API_BASE_URL` 注入为 `http://localhost:8000`;如需覆盖,可显式设置 `VITE_API_BASE_URL`
|
- `docker compose` 构建前端容器时,默认不注入 `VITE_API_BASE_URL`,生产会走同域 `/api/v1/*`;仅在本地直连后端时才显式设置 `VITE_API_BASE_URL=http://localhost:8000`
|
||||||
|
|
||||||
## 仓库治理文档
|
## 仓库治理文档
|
||||||
- 分支治理规范:`docs/branch-governance.md`
|
- 分支治理规范:`docs/branch-governance.md`
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ services:
|
|||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8000}
|
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-}
|
||||||
container_name: ctms_frontend
|
container_name: ctms_frontend
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user