This repository has been archived on 2026-09-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BPOS-MVP/apps/web
ChaiHaoandClaude Opus 5 2b1d983678 Web 开发服务器显式绑 IPv4 回环 —— 127.0.0.1 从前直接连不上
不给 `server.host` 时 vite 走 Node 默认解析,在本机上**只绑到 `[::1]`**:
`http://127.0.0.1:5273` 连不上,而 `localhost` 通不通取决于浏览器/系统把它解析成哪个栈。
同一台机器上表现为「有时打得开有时打不开」,查起来极费劲。

绑 `127.0.0.1` 之后两种写法都通,且不暴露到局域网(要给别的设备访问再显式 `--host`,
那是另一个决定)。代理目标也一并从 `localhost:8787` 换成 `127.0.0.1:8787`,
免得同一处歧义在代理侧再来一遍。

实测:改前 `127.0.0.1:5273` → 连不上、`[::1]:5273` → 200;
改后 `127.0.0.1` 与 `localhost` 都 200,且只靠配置生效、不必带命令行参数。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
2026-07-28 14:07:00 +08:00
..