Add a packaged-client runtime boundary so the shared UI can talk to local, desktop, remote, and VS Code runtimes through the right transport instead of assuming one same-origin web server. Centralize OpenChamber-owned API access behind RuntimeAPIs, runtimeFetch, and runtime URL helpers, while keeping official OpenCode traffic on the SDK path. Support runtime switching, remote host selection, desktop client credentials, and headless connection links for pairing packaged clients with remote OpenChamber servers. Harden the new auth model by moving long-lived client tokens out of browser URLs, introducing short-lived scoped URL tokens for browser-owned transports, restricting URL-token access to explicit readable/realtime routes, and making client-token management session-scoped or self-scoped as appropriate. Update browser-owned assets and preview proxy flows to work with the split runtime model, including authenticated project icons, preview token propagation, CSP-safe preview bridge injection, and preview proxy auth that survives short-lived URL-token expiry. Tighten Electron security boundaries for packaged clients by gating privileged preload state to trusted origins and requiring explicit confirmation before connect deep-links import or switch remote runtimes. Also refresh agent guidance and project skills so future runtime/API, auth, preview, UI, CLI, settings, locale, and drag-to-reorder work follows the new architecture.
118 lines
3.1 KiB
Plaintext
118 lines
3.1 KiB
Plaintext
---
|
|
title: Tunnels
|
|
description: Expose OpenChamber safely for remote and mobile access.
|
|
---
|
|
|
|
# Tunnels
|
|
|
|
A tunnel is a public link to your OpenChamber, so you can reach it from your phone or another network. Use `openchamber tunnel` to create one for a running instance.
|
|
|
|
## Prerequisites
|
|
|
|
OpenChamber starts the tunnel provider CLI on your machine. Install the provider you want to use first:
|
|
|
|
```bash
|
|
brew install cloudflared
|
|
brew install ngrok
|
|
```
|
|
|
|
Cloudflare quick tunnels can run with `cloudflared`. Ngrok requires an ngrok account and an authtoken from the ngrok dashboard:
|
|
|
|
```bash
|
|
ngrok config add-authtoken <your-ngrok-token>
|
|
```
|
|
|
|
## Quick start
|
|
|
|
1. Start OpenChamber:
|
|
|
|
```bash
|
|
openchamber
|
|
```
|
|
|
|
If you skip this step, `openchamber tunnel start` can auto-start a CLI server. When auto-starting, you can pass server options such as `--port`, `--host`, `--lan`, `--ui-password`, and `--api-only`.
|
|
|
|
2. Start a Cloudflare tunnel:
|
|
|
|
```bash
|
|
openchamber tunnel start --provider cloudflare --mode quick
|
|
```
|
|
|
|
Or start an Ngrok tunnel:
|
|
|
|
```bash
|
|
openchamber tunnel start --provider ngrok --mode quick
|
|
```
|
|
|
|
3. Check status:
|
|
|
|
```bash
|
|
openchamber tunnel status
|
|
```
|
|
|
|
When the tunnel is up, `status` shows a public URL. Open it, or scan the QR code, to reach OpenChamber from anywhere.
|
|
|
|
By default, OpenChamber prints a QR code in interactive TTY sessions. Use `--qr` to force QR output, or `--no-qr` to disable it.
|
|
|
|
## Providers
|
|
|
|
- `cloudflare`: quick, managed remote, and managed local modes
|
|
- `ngrok`: quick mode
|
|
|
|
## Managed modes
|
|
|
|
### Managed remote
|
|
|
|
Use a token + hostname managed by Cloudflare:
|
|
|
|
```bash
|
|
openchamber tunnel start --provider cloudflare --mode managed-remote --token-file ~/.secrets/cf-token --hostname app.example.com
|
|
```
|
|
|
|
### Managed local
|
|
|
|
Use a local `cloudflared` config:
|
|
|
|
```bash
|
|
openchamber tunnel start --provider cloudflare --mode managed-local --config ~/.cloudflared/config.yml
|
|
```
|
|
|
|
## Profiles (managed-remote)
|
|
|
|
Save a reusable profile:
|
|
|
|
```bash
|
|
openchamber tunnel profile add --provider cloudflare --mode managed-remote --name prod-main --hostname app.example.com --token-file ~/.secrets/cf-token
|
|
```
|
|
|
|
Start using the saved profile:
|
|
|
|
```bash
|
|
openchamber tunnel start --profile prod-main
|
|
```
|
|
|
|
## Useful commands
|
|
|
|
```bash
|
|
openchamber tunnel providers
|
|
openchamber tunnel ready --provider cloudflare
|
|
openchamber tunnel ready --provider ngrok
|
|
openchamber tunnel doctor --provider cloudflare
|
|
openchamber tunnel doctor --provider ngrok
|
|
openchamber tunnel stop --port 3000
|
|
```
|
|
|
|
## Behavior notes
|
|
|
|
- one active tunnel per OpenChamber instance (port)
|
|
- starting a new mode/provider on same instance replaces previous tunnel
|
|
- generating a new connect link revokes previous unused one
|
|
- tunnel auto-start preserves server flags like `--ui-password` and `--api-only` in the instance settings used by restart/update flows
|
|
|
|
## Related
|
|
|
|
- [Security](/security/) — protect the UI before exposing it
|
|
- [Desktop Tunnels](/desktop-tunnels/) — desktop app tunnel setup without CLI startup
|
|
- [PWA & Mobile](/mobile/) — reach OpenChamber from your phone
|
|
- [Troubleshooting](/troubleshooting/) — if the tunnel link doesn't work
|