diff --git a/JY-Salon-Front/vite.config.ts b/JY-Salon-Front/vite.config.ts index 2189819f..39f33eb3 100644 --- a/JY-Salon-Front/vite.config.ts +++ b/JY-Salon-Front/vite.config.ts @@ -17,7 +17,7 @@ export default defineConfig(({ mode }) => { }, server: { port: 3001, - host: true, + host: '0.0.0.0', proxy: { '/admin/api': { target: proxyTarget, @@ -30,7 +30,7 @@ export default defineConfig(({ mode }) => { rewrite: targetPath => proxyToCoreDirectly ? targetPath.replace(/^\/api/, '') : targetPath } }, - allowedHosts: ['localhost', '127.0.0.1', '2666.online', 'wcy111.top'] + allowedHosts: true } } }) diff --git a/scripts/JY-Salon-Front开发后端地址配置说明_20260630.md b/scripts/JY-Salon-Front开发后端地址配置说明_20260630.md index ef684b6d..77218e4c 100644 --- a/scripts/JY-Salon-Front开发后端地址配置说明_20260630.md +++ b/scripts/JY-Salon-Front开发后端地址配置说明_20260630.md @@ -18,6 +18,8 @@ VITE_DEV_PROXY_TARGET=http://dev.yunail.art:18888 前端代码仍然使用 `/api` 和 `/admin/api` 作为请求前缀,由 Vite 在开发环境中转发到上述地址。 +开发服务监听所有网卡地址,不限制为本机访问。局域网或隧道访问时仍使用相同的 `/jy-salon-front/` 基础路径。 + ## 验证方式 启动店务前端后验证: @@ -27,3 +29,11 @@ GET http://127.0.0.1:3001/api/legal-agreement/current ``` 应返回 `200`,并由 `dev.yunail.art:18888` 后端提供响应。 + +确认监听地址: + +```text +netstat -ano | findstr :3001 +``` + +应显示 `0.0.0.0:3001` 或等效的全地址监听。