feat: support HTTPS URLs in PLAYWRITER_HOST + remote access guide
PLAYWRITER_HOST now accepts full URLs like `https://x-tunnel.traforo.dev` in addition to plain hostnames. Previously it always constructed `http://${host}:19988` which broke when using traforo tunnels (HTTPS on port 443). Added `parseRelayHost()` utility that detects URL protocols and returns correct HTTP/WebSocket base URLs. Updated all consumers: - cli.ts: getServerUrl() - mcp.ts: getLogServerUrl(), checkRemoteServer() - executor.ts: checkExtensionStatus() - utils.ts: getCdpUrl() (ws:// → wss:// for HTTPS hosts) Plain hostnames still work as before (appends :19988). Added docs/remote-access.md covering: - Architecture: playwriter serve + traforo tunnel through Cloudflare - Host and remote machine setup with env vars - Use cases: remote Mac mini, user support, multi-machine, VM/devcontainer - Security model: non-guessable URLs, token auth, localhost-only extension endpoint, no open ports, visible automation, instant revocation
This commit is contained in:
@@ -180,28 +180,24 @@ Color-coded: yellow=links, orange=buttons, coral=inputs, pink=checkboxes, peach=
|
||||
+---------------------+ (no extension click) +-----------------+
|
||||
```
|
||||
|
||||
## Remote CLI
|
||||
## Remote Access
|
||||
|
||||
Run CLI from a different machine (devcontainer, VM, SSH) while Chrome runs on your host.
|
||||
Control Chrome on a remote machine over the internet using [traforo](https://traforo.dev) tunnels:
|
||||
|
||||
**On host:**
|
||||
```bash
|
||||
playwriter serve --token <secret>
|
||||
npx -y traforo -p 19988 -t my-machine -- npx -y playwriter serve --token <secret>
|
||||
```
|
||||
|
||||
**From remote:**
|
||||
```bash
|
||||
playwriter --host 192.168.1.10 --token <secret> session new
|
||||
playwriter --host 192.168.1.10 --token <secret> -s 1 -e "await page.goto('https://example.com')"
|
||||
```
|
||||
|
||||
Or with env vars:
|
||||
```bash
|
||||
export PLAYWRITER_HOST=192.168.1.10
|
||||
export PLAYWRITER_HOST=https://my-machine-tunnel.traforo.dev
|
||||
export PLAYWRITER_TOKEN=<secret>
|
||||
playwriter -s 1 -e "await page.goto('https://example.com')"
|
||||
```
|
||||
|
||||
Also works on a LAN without traforo (`PLAYWRITER_HOST=192.168.1.10`). Full guide with use cases (remote Mac mini, user support, multi-machine control): [docs/remote-access.md](./docs/remote-access.md)
|
||||
|
||||
## Security
|
||||
|
||||
- **Local only**: WebSocket server on `localhost:19988`
|
||||
|
||||
Reference in New Issue
Block a user