docs: add VITE_API_BASE_URL for remote/VPS deployment

Document how to configure frontend-backend communication for remote access.
The Vite dev server proxy (/api -> localhost:5001) only works in local development.
When deploying on a VPS or accessing from a different machine, users must set
VITE_API_BASE_URL to the server's actual IP/URL.

Changes:
- Add VITE_API_BASE_URL to .env.example with usage instructions
- Add remote deployment note to README.md (English)
- Add remote deployment note to README-ZH.md (Chinese)
This commit is contained in:
MiroFish Contributor 2026-04-10 10:20:04 +08:00
parent fa0f6519b1
commit f2805d90a9
3 changed files with 27 additions and 1 deletions

View File

@ -14,3 +14,11 @@ ZEP_API_KEY=your_zep_api_key_here
LLM_BOOST_API_KEY=your_api_key_here
LLM_BOOST_BASE_URL=your_base_url_here
LLM_BOOST_MODEL_NAME=your_model_name_here
# ===== 前端部署配置 =====
# 仅在使用源码部署并从非本机访问时需要设置
# 对于远程服务器/VPS部署必须设置为后端实际可访问的地址
# 示例VITE_API_BASE_URL=http://你的服务器IP:5001
# 本地开发时默认使用 http://localhost:5001无需设置
# 注意Vite开发服务器的代理配置(/api)仅在本地开发时有效production构建后需设置此变量
VITE_API_BASE_URL=http://localhost:5001

View File

@ -155,6 +155,15 @@ npm run dev
- 前端:`http://localhost:3000`
- 后端 API`http://localhost:5001`
> **远程部署说明:** 如果您从不同于运行MiroFish的机器例如在VPS上访问MiroFish您必须在构建前端之前设置 `VITE_API_BASE_URL` 环境变量为您的服务器IP或域名。否则前端会尝试连接浏览器本机的 `localhost:5001` 而不是服务器。
>
> ```bash
> # 远程部署示例
> VITE_API_BASE_URL=http://你的服务器IP:5001 npm run build
> ```
>
> Vite开发服务器的代理配置`/api` → `http://localhost:5001`)仅在本地开发模式下有效,在生产环境构建后需要设置此变量。
**单独启动:**
```bash

View File

@ -155,6 +155,15 @@ npm run dev
- Frontend: `http://localhost:3000`
- Backend API: `http://localhost:5001`
> **Remote/VPS Deployment Note:** If you are accessing MiroFish from a different machine than where it's running (e.g., on a VPS), you must set the `VITE_API_BASE_URL` environment variable to your server's IP or domain before building the frontend. Without this, the frontend will try to connect to `localhost:5001` on the *browser's* machine instead of the server.
>
> ```bash
> # Example for remote deployment
> VITE_API_BASE_URL=http://YOUR_SERVER_IP:5001 npm run build
> ```
>
> The Vite dev server proxy (`/api` → `http://localhost:5001`) only works in local development mode, not in production builds.
**Start Individually:**
```bash