From f1a20a9fe9ceae8cd1b36c6df8f105111dffb0c6 Mon Sep 17 00:00:00 2001 From: Matt Cowger Date: Mon, 1 Jun 2026 23:08:41 -0700 Subject: [PATCH] Add configurable service proxy (#1280) * Add configurable service proxy * Fix service proxy URL used when opening scripts with a public base URL When a public proxy URL was configured, the View link was falling through to direct connection logic and opening the wrong URL. Move the public URL early-return before connection-type checks, and remove the now-dead duplicate check further down. * Add service proxy documentation Covers config options, URL generation format, wildcard DNS setup, and reverse proxy Host header requirements. * Cap combined public service label and document hostname format * Address service proxy review feedback --- CLAUDE.md | 1 + docs/service-proxy.md | 90 +++++++++++++++++++ .../app/src/utils/workspace-script-links.ts | 19 ++++ packages/server/src/server/bootstrap.ts | 85 ++++++++++++++++++ .../server/src/server/config-relay.test.ts | 37 ++++++++ packages/server/src/server/config.ts | 41 +++++++++ .../server/src/server/persisted-config.ts | 8 ++ packages/server/src/server/script-proxy.ts | 49 ++++++++-- .../script-route-branch-handler.test.ts | 42 +++++++++ .../src/server/script-route-branch-handler.ts | 18 +++- .../src/server/script-status-projection.ts | 53 +++++++++-- packages/server/src/server/session.ts | 8 ++ .../server/src/server/websocket-server.ts | 6 ++ .../src/server/workspace-service-env.ts | 53 +++++++---- .../server/src/server/worktree-bootstrap.ts | 18 +++- .../server/src/server/worktree-session.ts | 1 + .../server/src/utils/script-hostname.test.ts | 57 +++++++++++- packages/server/src/utils/script-hostname.ts | 48 ++++++++++ .../public/schemas/paseo.config.v1.json | 16 ++++ 19 files changed, 614 insertions(+), 36 deletions(-) create mode 100644 docs/service-proxy.md diff --git a/CLAUDE.md b/CLAUDE.md index 58c10a571..187b563ec 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,6 +36,7 @@ At the start of non-trivial work, list `docs/` and skim anything relevant to the | [docs/file-icons.md](docs/file-icons.md) | Material icon theme integration for the file explorer | | [docs/providers.md](docs/providers.md) | Adding a new agent provider end-to-end | | [docs/custom-providers.md](docs/custom-providers.md) | Custom provider config: Z.AI, Alibaba/Qwen, ACP agents, profiles, custom binaries | +| [docs/service-proxy.md](docs/service-proxy.md) | Service proxy: exposing workspace scripts at public URLs, DNS setup, reverse proxy config | | [docs/development.md](docs/development.md) | Dev server, build sync gotchas, CLI reference, agent state, Playwright MCP | | [docs/rpc-namespacing.md](docs/rpc-namespacing.md) | WebSocket RPC naming convention — dotted namespaces and `.request`/`.response` pairs | | [docs/testing.md](docs/testing.md) | TDD workflow, determinism, real dependencies over mocks, test organization | diff --git a/docs/service-proxy.md b/docs/service-proxy.md new file mode 100644 index 000000000..822a4c3e5 --- /dev/null +++ b/docs/service-proxy.md @@ -0,0 +1,90 @@ +# Service Proxy + +Paseo can proxy HTTP traffic to services running inside your workspaces and expose them at stable, publicly-accessible URLs. This lets you open a running dev server from your phone or share it with a teammate without any tunneling tools. + +## How it works + +When a `paseo.json` script of `"type": "service"` starts, Paseo assigns it a local port and registers a route in the service proxy. Incoming requests whose `Host` header matches the script's generated hostname are forwarded to that port. + +The generated hostname is built from the script name, branch, and project: + +``` +