放开店务前端开发访问地址

This commit is contained in:
2026-06-30 23:15:17 +08:00
parent 4f4a782354
commit a8469d1916
2 changed files with 12 additions and 2 deletions
+2 -2
View File
@@ -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
}
}
})
@@ -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` 或等效的全地址监听。