docs: for localhost access

This commit is contained in:
weishu
2026-03-16 08:54:04 +08:00
parent ce5edc42e1
commit bfc9ad9f0c
+26
View File
@@ -37,6 +37,8 @@ For local network access:
http://<your-computer-ip>:3006
```
If your phone cannot connect, make sure the hub is not only listening on `127.0.0.1`. For LAN access, set `listenHost` to `0.0.0.0` in `~/.hapi/settings.json` or set `HAPI_LISTEN_HOST=0.0.0.0`, then restart `hapi hub`.
For internet access:
- If the hub has a public IP, access it directly (use HTTPS via reverse proxy for production)
- If behind NAT, set up a tunnel (Cloudflare Tunnel, Tailscale, or ngrok)
@@ -129,6 +131,30 @@ Only if they have your access token. For additional security:
- Check firewall allows port 3006
- Verify `HAPI_API_URL` is correct
### My phone cannot access HAPI on the local network
If HAPI works on your computer but not from another device on the same LAN, check the hub bind address first. By default, HAPI listens on `127.0.0.1`, which only accepts localhost connections.
Use one of these:
```json
{
"listenHost": "0.0.0.0"
}
```
```bash
export HAPI_LISTEN_HOST=0.0.0.0
```
Then restart `hapi hub` and open:
```bash
http://<your-computer-ip>:3006
```
Also verify your OS firewall allows inbound connections on port `3006`.
### "Invalid token" error
- Re-run `hapi auth login`