# dev-code-proxy > dev-code-proxy (command: dcp) gives local dev servers real HTTPS addresses. On this machine: https://.localhost for an app started with `dcp run`, with a certificate the OS trusts. Online: one stable URL per running dev server, through Tailscale (https://..ts.net//, Funnel public or Serve tailnet only) and, when turned on, a Cloudflare Tunnel under your own domain (https://-.), for webhooks, OAuth callbacks, phones and teammates. Open source, one Go binary, macOS, Linux, Windows. ## Agent prompt ```text You are working in a project whose dev servers run through dev-code-proxy (dcp). Use it instead of raw ports. Check the machine first, and fix what is missing: - `dcp --version` (missing: `brew install meabed/tap/dcp` or `npm i -g dev-code-proxy`) - `dcp doctor` checks both halves and each sharing provider; each ✗ is followed by the command that fixes it, and it exits 1 when one fails. - `dcp service install` fixes local HTTPS; it may ask the user for their password once, so tell them. - Tailscale sign-in and Funnel are the user's to do in a browser; give them the link doctor prints. Run an app at a local HTTPS name: - Start the dev server the usual way (npm run dev, uvicorn, rails s, go run .): dcp finds it and serves it at https://.localhost. Never hard-code a port. - To pick the name, put it in the project: .dcp.json { "name": "." }, or the "dcp" key of package.json / deno.json, [tool.dcp] in pyproject.toml, [package.metadata.dcp] in Cargo.toml, "extra"."dcp" in composer.json. - `dcp ls --json` lists every app and link, one entry each (name, port, pid, source "found" or "run", dir, provider local/tailscale/cloudflare, url, state up/online/not shared/exited, public); https://dcp.localhost/api/status has them with requests and latency. - A port is taken by a dev server left running: `dcp stop ` or `dcp stop `, with --yes (there is no terminal to ask in) and --force when it ignores SIGTERM. Stop only servers you started, unless the user says so. - To run a command through dcp instead (it picks a free port and sets $PORT and $HOST): `dcp run -- ''`, e.g. `dcp run api.acme -- 'uvicorn main:app --port $PORT --host $HOST'`. Share an app online (webhooks, OAuth callbacks, a phone, a teammate): - Sharing is on by default: the local HTTPS proxy keeps every dev server online through Tailscale (Funnel), after reboots too. `dcp url --tailscale` (or `--cloudflare`) prints just that URL, e.g. `curl $(dcp url api --cloudflare)/health`; it exits 1 when the link is not online yet. - `dcp status --json` says per provider whether it is on and online, and otherwise the problem, the fix and a docs link; `dcp check` opens every link from the outside (DNS, certificate, HTTP status). Run the fix it names, or hand it to the user when it is theirs (a sign-in, an admin page). - Cloudflare (a public link under the user's own domain) is off until set up once: `dcp cloudflare on --zone --env-file `. The token needs Account › Cloudflare Tunnel › Edit and Zone › DNS › Edit; ask the user for it, never invent one. - `dcp tailscale on --tailnet` limits Tailscale to the tailnet (Serve); `dcp tailscale off` and `dcp cloudflare off` turn them off. Change these only when the user asks. - The URL is the same every time on this machine, so register it once with Stripe, GitHub, Slack or an OAuth provider. - Apps see Host: localhost by default; use `dcp --forward-host` when the app builds absolute URLs (OAuth redirects). Report the URLs you used. Docs for agents: https://dev-code-proxy.com/llms-full.txt ``` # Install dcp is one binary with two halves. Set up the half you need, or both: they don't depend on each other. | You want | Set up | Takes | | --- | --- | --- | | `https://.localhost` on this machine | [Local HTTPS](#2-local-https-once-per-machine) | one command, your password once per machine | | A link that works from anywhere (webhooks, callbacks, sharing) | [Tailscale](#3-tailscale-for-online-links) | a free Tailscale account, two switches in its admin console | | A public link under your own domain | [Cloudflare](/share#cloudflare) | a domain on Cloudflare, an API token, one `dcp cloudflare on` | ## 1. Install dcp ```bash brew install meabed/tap/dcp ``` ```bash npm i -g dev-code-proxy # the command is still dcp; a small Node launcher runs it ``` ```bash go install github.com/meabed/dev-code-proxy@latest ``` ```bash npx dev-code-proxy doctor # any command, without installing ``` Homebrew is the lightest on macOS and Linux: the binary runs directly, with no Node process beside each `dcp run`. macOS, Linux, Windows and WSL, on amd64 and arm64. Prefer a window to a terminal? The [desktop app](/desktop) shares dev servers from the menu bar. ## 2. Local HTTPS, once per machine ```bash dcp service install ``` ``` ✓ boot service /Library/LaunchDaemons/com.meabed.dev-code-proxy.plist ✓ proxy running (dcp 1.11.0, pid 57001, port 443) ✓ local CA trusted by the OS ``` It starts the local proxy at boot and adds its certificate authority to the system's trust store, so browsers, curl, Bun and Node accept `https://.localhost`. Your password is asked once: port 443 needs admin rights to open. After that the proxy keeps itself current: a newer dcp, from `brew upgrade`, `npm update` or its own daily check, takes over within seconds, with no password and no command to run. Running `dcp service install` again is always safe; it checks what is in place and fixes only what is missing. `dcp service status` prints the same lines and exits 1 if any is off. That's all: start a dev server the way you always do and it answers at `https://.localhost`. Open `https://dcp.localhost` to see the names. Naming apps and other ways to run them: [Local HTTPS names](/local-https). ## 3. Tailscale, for online links [Tailscale](https://tailscale.com) carries the online links: it gives your machine a stable name and a certificate, and its Funnel feature makes a port reachable from the internet. The free plan is enough. ```bash brew install --cask tailscale # or the app from tailscale.com/download tailscale up # sign in in the browser ``` ```bash curl -fsSL https://tailscale.com/install.sh | sh sudo tailscale up ``` ```powershell winget install tailscale.tailscale tailscale up ``` Two switches in the [admin console](https://login.tailscale.com/admin), once per Tailscale network: 1. **DNS:** turn on MagicDNS and HTTPS Certificates ([guide](https://tailscale.com/kb/1153/enabling-https)). 2. **Access controls:** allow Funnel, which public links need ([guide](https://tailscale.com/kb/1223/funnel)): ```jsonc { "nodeAttrs": [{ "target": ["autogroup:member"], "attr": ["funnel"] }] } ``` Links only for your own devices and teammates on your Tailscale network don't need step 2: use `dcp tailscale on --tailnet`. Check both halves at once: ```bash dcp doctor ``` ``` Sharing online (https://..ts.net//, through Tailscale) ✓ tailscale installed (1.104.7) ✓ tailscale up ✓ funnel enabled ✓ service discovery (6 service(s) in 3000-6000) ✓ tailscale: online at https://bigfoot.tail1234.ts.net, anyone with a link (6 apps) ✓ cloudflare: off note: dcp cloudflare on --zone example.com turns it on Local HTTPS names (https://.localhost: every dev server found, and dcp run apps) ✓ boot service /Library/LaunchDaemons/com.meabed.dev-code-proxy.plist ✓ proxy running (dcp 1.16.2, pid 57001, port 443) ✓ http://*.localhost redirects to https ✓ local CA trusted by the OS ✓ finds dev servers on ports 3000-6000 (2 found now; scans every 10s while in use, 1m0s idle) ✓ dashboard: https://dcp.localhost (every app, its links, CPU, memory, requests, Stop) ✓ auto-update on (checked 2h ago, latest 1.16.2) All checks passed: your dev servers answer at https://.localhost and online at their Tailscale links. Every app with both links: https://dcp.localhost ``` Each ✗ is followed by the command that fixes it (a page for what only Tailscale's admin console changes), and the last line says which half is ready. Each sharing provider gets one line: online, not online with its fix, or off with the command that turns it on. Sharing online is on by default: [Share online](/share). ## Updates The local proxy updates itself without dropping a request: once a day it checks for a release and verifies the download against the release's checksums. The new version starts beside the running one and must answer a real HTTPS request before it takes over; then the old one finishes its requests and stops. A version that fails that check, or crashes in its first minute, is set aside and skipped, and the previous one keeps serving. `dcp logs` shows each swap. In a terminal, dcp tells you once a day when a release is out for the command itself. ```bash dcp update # now: runs brew or npm when that is how dcp was installed dcp configure --auto-update=false # no automatic updates (DCP_NO_UPDATE=1 for one shell; off in CI) ``` ## Remove ```bash dcp uninstall # asks first; --yes to skip the question ``` ``` ✓ Tailscale Serve/Funnel entry removed (it pointed at 127.0.0.1:18443) ✓ boot service removed: nothing answers https://*.localhost now ✓ local CA removed from the OS trust store ✓ /Users/you/.dcp emptied (config.json kept: --all removes it) Last step, the dcp command: brew uninstall dcp ``` A step with nothing to do prints `–`; one that fails prints `✗` and the command to finish it by hand. It removes only a Tailscale entry that points at dcp, so it never takes down someone else's. Safe to run twice. `dcp service uninstall` removes just the boot service. # Local HTTPS names Every dev server on this machine gets a stable HTTPS name, for as long as it runs. Start it the way you always do: dcp finds it and names it after its folder, or after the name in your project's config. `https://web.acme.localhost` - `https://`: A certificate signed by a certificate authority that only this machine trusts. - `web.acme`: The folder's name, or the one your project's config gives it. - `.localhost`: Every OS sends *.localhost to this machine itself; nothing leaves it. ## Why a name instead of `localhost:3000` - **HTTPS like production.** Secure cookies, `SameSite=None`, service workers, passkeys, the clipboard API and OAuth libraries that refuse plain HTTP all work. - **Names, not ports.** You open `web.acme.localhost`, whatever port the server picked today; with `dcp run`, dcp picks a free port for it, so two projects that both want port 3000 stop colliding. - **Names that say what they are.** `api.acme.localhost` and `web.acme.localhost` instead of two numbers; cookies scoped to `.acme.localhost` are shared between them. - **Subdomains per tenant.** With `help-chat` running, `https://acme.help-chat.localhost` reaches it too. ## Set up a machine (once) ```bash dcp service install # the proxy from boot + the CA trusted; re-run any time, it fixes what is off dcp service status # three ✓ lines, exit 1 when one is off ``` ## Start your app as usual ```bash cd ~/acme/web && npm run dev # Vite on 5173, as always ``` ``` $ dcp ls NAME PORT PROVIDER STATE URL web 5173 local up https://web.localhost web 5173 tailscale online https://laptop.tail1234.ts.net/web/ ``` The `tailscale` line is the same app's link online: sharing online is on by default; see [Its links online](#its-links-online). No script changes, and nobody else on the project needs dcp. The local proxy looks for dev servers in your port range (the one in [Configuration](/configuration), plus 4000–4999) and gives each the name of its project folder. It looks every 10 seconds while you use the names and every minute otherwise, and it looks again the moment you open a name it doesn't know yet, so a server you just started answers on the first request. A server that stops loses its name after a few scans. ### Pick the name Put the name in the project's config, in whichever file the project already has. The first one found in the project folder wins. ```json { "name": "web.acme" } ``` Any language. Use it for Go, Ruby, PHP without Composer, or to keep the setting out of a shared manifest. ```jsonc "dcp": { "name": "web.acme" } ``` ```toml [tool.dcp] name = "api.acme" share = "private" ``` ```toml [package.metadata.dcp] name = "svc.acme" port = 8080 ``` ```json "extra": { "dcp": { "name": "shop.acme" } } ``` ```jsonc "dcp": { "name": "edge.acme" } // deno.json or deno.jsonc ``` | Field | Default | What it does | | --- | --- | --- | | `name` | the folder's name | the app's address, `https://.localhost` | | `port` | the lowest port | which listener is the app, when the project runs several servers | | `share` | your global mode | online: `"public"`, `"private"` (Tailscale on your tailnet only, never Cloudflare) or `false` (neither provider) | | `path` | the name's first label | the app's path online, `https://.ts.net//` | | `enabled` | `true` | `false` keeps dcp away from the project entirely | | `script` | none | for `dcp run` only (below) | dcp reads a config file only if you own it and nobody else can write it, and never looks above your home folder or inside a folder everyone can write, such as `/tmp`. A file it refuses or can't parse leaves the project out (nothing falls back to defaults), and `dcp doctor`, `dcp ls` and the dashboard say which file and the command that fixes it. To turn discovery off: `dcp configure --discover=false`. The app receives the request with its own name as the host (`Host: web.acme.localhost`) and `X-Forwarded-Proto: https`, `X-Forwarded-Host` and `X-Forwarded-For`. Vite and Next.js accept `*.localhost` as they come; Django and Rails check the host: ```python # Django settings.py ALLOWED_HOSTS = [".localhost"] CSRF_TRUSTED_ORIGINS = ["https://*.localhost"] ``` ```ruby # Rails config/environments/development.rb config.hosts << ".localhost" ``` ## Or run it through dcp `dcp run` starts the server for you on a free port it keeps for that name (4000–4999), sets `PORT` and `HOST`, and holds the name while the command runs: useful when two projects want the same port, or in scripts. **In a `package.json` project**, keep the real command as its own script and point `dev` at dcp. `npm run dev`, `pnpm dev`, `yarn dev` and `bun dev` all work: the script runs with the package manager that started it. ```jsonc "scripts": { "dev": "dcp run", "dev:app": "vite --port $PORT --host $HOST --strictPort" }, "dcp": { "name": "web.acme", "script": "dev:app" } ``` **Anything else**: give the name and the command. A command in one quoted string runs through the shell after dcp sets `PORT` and `HOST`; several arguments run as they are, for servers that read `PORT` themselves. ```bash dcp run web.acme -- 'vite --port $PORT --host $HOST' ``` Astro, SvelteKit, Nuxt and React Router take the same `--port $PORT --host $HOST`. ```bash dcp run web.acme -- 'next dev -p $PORT -H $HOST' ``` ```bash dcp run api.acme -- 'uvicorn main:app --reload --port $PORT --host $HOST' # FastAPI dcp run api.acme -- 'flask run --port $PORT --host $HOST' # Flask ``` ```bash dcp run web.acme -- 'python manage.py runserver $HOST:$PORT' ``` ```bash dcp run web.acme -- 'bin/rails server -p $PORT -b $HOST' ``` ```bash dcp run web.acme -- 'php -S $HOST:$PORT -t public' # plain PHP dcp run web.acme -- 'php artisan serve --host=$HOST --port=$PORT' # Laravel ``` ```bash dcp run api.acme -- node server.js # reads process.env.PORT dcp run api.acme -- bun --hot src/index.ts # Bun.serve reads PORT dcp run api.acme -- deno run -A --watch main.ts # Deno.env.get("PORT") ``` ```bash dcp run api.acme -- go run . ``` ```go addr := net.JoinHostPort(os.Getenv("HOST"), os.Getenv("PORT")) log.Fatal(http.ListenAndServe(addr, mux)) ``` A Rust server reads them the same way: `dcp run api.acme -- cargo run`. ```bash dcp run api.acme -- 'docker run --rm -p $HOST:$PORT:8080 acme/api' ``` The container keeps its own port (8080 here); Docker publishes it on the port dcp picked. | `dcp run` sets | Value | | --- | --- | | `PORT` | a port in 4000–4999, the same for a name run after run while it is free | | `HOST` | `127.0.0.1` | | `NODE_EXTRA_CA_CERTS` | the local CA, unless already set, so Node and Bun trust other `.localhost` names | A `dcp run` name wins over a found one. `dcp run --force` takes a name over from another terminal; `DCP=0 npm run dev` runs the `dev:app` script as it is, without dcp. The name `dcp` is reserved for the dashboard. ## Its links online The `.localhost` name is for this machine. The same app is also online, for a phone, a teammate's laptop or a webhook: sharing is on by default, through Tailscale Funnel (anyone with a link; `dcp tailscale on --tailnet` for your tailnet only, through Serve), and through Cloudflare once you turn it on, and the proxy keeps it on after reboots ([Share online](/share)). Each app has a link like `https://laptop.tail1234.ts.net/web/` (and `https://web-laptop.example.com` through Cloudflare), the same every time, and dcp shows it next to the local name everywhere, with a way to copy it: - The dashboard shows a row per provider under each name, tagged **local**, **tailscale** or **cloudflare**, with a **Copy** button; the banner above the table has one row per provider: online, not online with the fix and a help link, or off with the command that turns it on (and Copy). - `dcp ls` prints a line per app and link, and `dcp ls --json` has each as `{name, port, pid, source, dir, provider, url, state, public}`; `dcp url web --tailscale` prints just one. - The [desktop app](/desktop)'s menu opens each from the app's **Open** section and copies it from **Copy**. While a provider is off or not online yet, dcp still shows each app's link, greyed with a dashed tag and not clickable (`shared: false` in `/api/status`, `not shared` in `dcp ls`): it opens nothing until it is online (the address has no DNS record), and the banner says why and how to fix it. Tailscale needs to be signed in, the port inside the configured range, and the project must not say `"share": false`. A project whose config says `"share": "private"` stays tailnet-only even under Funnel, and off Cloudflare. The share writes what it puts online to `~/.dcp/online.json`, per provider, after every look and removes it when it stops. ## Restart or reload You rarely need either: settings apply by themselves within a second, and new dev servers are found on the next scan or the moment you open their name. ```bash dcp reload # read the settings again and look for dev servers now dcp restart # a fresh copy of the proxy takes over, as a live update does ``` `dcp restart` needs no sudo and drops no request: the boot service starts a new copy of the release serving, waits until it serves, then hands over and lets the old one finish its requests. If the new copy does not start, the old one keeps serving and the error says why. The boot service's supervisor answers it from launcher revision 4 (dcp 1.21.1): one installed earlier says so, and `dcp service install` updates it once (it asks for your password; `dcp doctor` notes it). Sharing online restarts with it; its Tailscale entry and Cloudflare tunnel stay in place throughout. ## The dashboard `https://dcp.localhost` shows what runs (how each was started, port, folder, uptime, its links online per provider), the CPU and memory of each app with every process it started (macOS, Linux), requests, failures and p50/p95 per name, the proxy's version, live updates and set-aside releases, discovery and update status, and any config file it skipped, with how to fix it. It updates itself every few seconds and is reachable only from this machine. The same data as JSON for scripts and agents: `https://dcp.localhost/api/status` (sharing per provider in `proxy.sharing.tailscale` and `proxy.sharing.cloudflare`, each app's links in `links.tailscale` and `links.cloudflare`: `{url, public, shared}`). It is on by default; `dcp configure --dashboard=false` turns it off, and `dcp.localhost` then answers like any name nothing serves. ## Stop an app A dev server left running in a forgotten terminal holds its port. Stop it by name or by port: ```bash dcp stop web.acme # the app at https://web.acme.localhost dcp stop 3000 # whatever listens on port 3000 dcp stop web.acme --force ``` `dcp stop` shows what it is about to end (process, pid, CPU and memory, how long it has run, port, folder) and the command it runs, then asks. It sends SIGTERM, as Ctrl-C in the app's terminal would, and waits up to 5 seconds for it and the processes it started to exit; a `dcp run` app ends with its `dcp run`. For an app that hangs, `--force` ends it and every process it started at once (SIGKILL), with no chance to clean up. On Windows it runs `taskkill /PID /T`, and `/F` with `--force`. `--yes` skips the question, for scripts and agents. On the dashboard, each app has a **Stop** button. It opens the same summary, with **Stop** and **Force stop** side by side, the exact command each runs, and the commands that do the same in a terminal on this OS, each with a copy button. A name whose process exited shows **exited**: dcp keeps a found name for a few scans in case it restarts. | | macOS, Linux | Windows | | --- | --- | --- | | Stop | `kill ` | `taskkill /PID /T` | | Force | `kill -9 ` | `taskkill /PID /T /F` | | By port | `lsof -ti tcp: -sTCP:LISTEN \| xargs kill` | `Get-NetTCPConnection -LocalPort -State Listen \| ForEach-Object { Stop-Process -Id $_.OwningProcess }` | The same through the API: `GET https://dcp.localhost/api/apps/` returns what a stop would end and how, and `POST https://dcp.localhost/api/apps//stop` with `{"force": false}` stops it (200 when it exited, 409 with the forced command when it did not). Only the dashboard's own page can stop an app from a browser: dcp refuses a request another website sends (it checks `Sec-Fetch-Site` and `Origin`, and asks for a JSON body, which a form cannot send). On macOS and Linux the request must also come from one of your own programs: dcp looks up the other end of that very connection and stops nothing for another account on the same machine. Windows offers no cheap way to check that, so there the dashboard shows the commands to copy, and `dcp stop` does the stopping in a terminal. dcp never stops itself, a process another user owns, or Docker: for a container's port it names the container to `docker stop` instead. ## Names nothing serves By default dcp answers only the names it serves: the apps it found or runs (and their subdomains) and the dashboard. A name nothing serves gets no answer, as if nothing listened, so a typo looks like a server that is not running. dcp still looks again before it gives up, so a server started a moment ago answers on the first request. With the catch-all on (`dcp configure --catch-all`), dcp answers every `.localhost` name: one nothing serves shows the names that do run and how to start an app under that one. Either way, a name whose app stopped answering shows its port, process, folder and the likely cause. A browser gets a page, curl gets the same as text. Both settings apply to the running proxy within a second, without a restart, as do `--discover` and `--local-request-log`; the ports, runtimes and Docker setting apply from the next scan. ## Plain HTTP `http://` gets what `https://` gets. Every `http://.localhost` that https answers, `dcp` included, redirects to the same URL over https (308: the method and body are kept), so a browser shows the very same page. `http://localhost/` and `http://127.0.0.1/` open the dashboard, like `https://localhost/`. A name https does not answer gets no answer on http either. With the catch-all on, any other host that reaches port 80 gets a short 404 that lists nothing, so a website whose name was re-pointed at 127.0.0.1 (DNS rebinding) learns nothing about this machine. If another program holds port 80, HTTPS keeps working and `dcp doctor` names the program. ## Subdomains A name also answers for its subdomains: with `help-chat` running, `https://acme.help-chat.localhost` reaches it too (the nearest registered parent wins), for apps that serve one tenant per subdomain. Need the same app online, for a webhook or a phone? A `dcp run` app is a dev server like any other: `dcp` finds it and gives it a link through Tailscale too. See [Share online](/share). ## Technical details - **Found servers** live in the proxy's memory: each scan lists the listening sockets in the port range with their process (reusing what it learned about each process, so an idle scan costs one `lsof`), keeps the web runtimes, finds each one's project folder and config, and maps names to ports. A project that runs several servers gets its main name on the lowest port (or the config's `port`) and `-` for the others. - **`dcp run` names** are one JSON file per running app in `~/.dcp/routes/.json` (`{name, port, pid, dir}`) and a lock its process holds. Both go when the run ends, and the proxy drops the name of a run killed with `kill -9` the next time it reads the folder, which it does only when the folder changes. - **Certificates**: a local CA in `~/.dcp/ca/` (ECDSA P-256, 10 years, key `0600`) signs one certificate per exact name on first use (90 days, renewed in memory). The CA carries a name constraint for `localhost`: it cannot sign a certificate for any other domain that a browser would accept. Names outside `.localhost` get no certificate, and the cache is bounded. - **The service** is a small supervisor that runs as root for one job: opening `127.0.0.1:443` and `[::1]:443`, which an ordinary process cannot do. It then switches to your user for good, keeps the sockets open for its whole life, and runs the proxy as a worker from your own copy of dcp in `~/.dcp/bin`. Root never runs a file you can write, and every file the proxy writes stays yours. While no worker runs, the supervisor serves the names itself, so they keep working. macOS: a launchd daemon (`/Library/LaunchDaemons/com.meabed.dev-code-proxy.plist`, log `/var/log/dev-code-proxy.log`). Linux: a systemd unit (`dev-code-proxy.service`, `journalctl -u dev-code-proxy`). - **Updates without a password or a dropped request**: any newer dcp you run copies itself into `~/.dcp/bin` (never an older one), and the proxy checks for a release once a day and verifies it against the release's `checksums.txt`. The supervisor starts the new version beside the serving one on the same sockets; once it answers a real HTTPS request it takes over and the old worker drains. A version that fails, or crashes within its first minute, is recorded as set aside in `bin/state.json` and never used again; the previous worker keeps serving. A crashing worker restarts with backoff. sudo is needed again only if the supervisor itself changes, which `dcp doctor` says. `dcp run` in a terminal sets up a machine that has no proxy yet; in CI or a pipe it only warns. - **Trust**: `dcp service install` ends with it (or `dcp trust` alone). macOS adds the CA to your login keychain (one password dialog at the screen; over SSH it is left as a next step). Debian/Ubuntu: `/usr/local/share/ca-certificates` + `update-ca-certificates`; Fedora/RHEL: `/etc/pki/ca-trust/source/anchors` + `update-ca-trust`. Windows: the user's Root store (`certutil -user`). ## Related - Every command and flag: [Commands](/commands#local-https-names) - A name that doesn't answer, a certificate warning, port 443 taken: [Troubleshooting](/troubleshooting#local-https-names-localhost) - The same app online, for webhooks and phones: [Share online](/share) # Share online dcp finds the dev servers running on this machine and gives each one a link online, through Tailscale, Cloudflare or both. Tailscale is on by default: a link for anyone, or private to your Tailscale network. Cloudflare is off until you turn it on: a public link under your own domain. Sharing stays on: the local HTTPS proxy runs it from boot, next to the `.localhost` names. Each link is the same every time. `https://bigfoot.tail1234.ts.net/web/pricing` - `https://`: Tailscale's certificate, valid in every browser. - `bigfoot.tail1234.ts.net`: This machine's name on your Tailscale network. It doesn't change between runs, reboots or networks. - `/web/`: The project folder the dev server runs from. dcp finds the server by its port; nothing to configure. - `pricing`: Everything after the project reaches the app unchanged: here, /pricing. ## Share what is running Start your dev servers the way you always do, each from its own project folder. After `dcp service install` (once per machine, the same step as the [local HTTPS names](/local-https)), every one of them is online: ``` $ dcp status ✓ tailscale online https://bigfoot.tail1234.ts.net, anyone with a link (3 apps) cloudflare off dcp cloudflare on --zone example.com turns it on Every app with its links: dcp ls, or https://dcp.localhost ``` `dcp status` prints one line per provider: online, not online with the problem, its fix and a help link, or off with the command that turns it on. It exits 1 when a provider that is on is not online; `--json` prints the same for scripts. A plain `dcp` prints it too. ``` $ dcp ls NAME PORT PROVIDER STATE URL api 4100 local up https://api.localhost api 4100 tailscale online https://bigfoot.tail1234.ts.net/api/ docs 3001 local up https://docs.localhost docs 3001 tailscale online https://bigfoot.tail1234.ts.net/docs/ web 4000 local up https://web.localhost web 4000 tailscale online https://bigfoot.tail1234.ts.net/web/ ``` `dcp ls` prints one line per app and link, so `grep` finds what you need; `dcp ls web` keeps the apps whose name, folder or URL has `web` in it, and `--json` has every field. For one URL: ```bash dcp url web # the best link: Cloudflare, else Tailscale, else local dcp url api --tailscale # or --local, --cloudflare curl $(dcp url api --cloudflare)/health dcp open web --tailscale # in the browser ``` `dcp url` exits 1 when the link is not online yet. A server that starts later is online within a scan (20 seconds by default), and one that restarts keeps its link. Each link also shows next to the app's `.localhost` name on [the dashboard](/local-https#the-dashboard) and in the [desktop app](/desktop), with Copy. ```bash dcp tailscale off && dcp cloudflare off # every provider off ``` ## Tailscale On by default. Every app gets `https://..ts.net//`, and the proxy keeps dcp's Funnel entry in place: after a reboot, a Tailscale restart or a settings change it is put back within seconds. It needs Tailscale signed in on this machine ([Install](/installation#3-tailscale-for-online-links)). ```bash dcp tailscale on --tailnet # your tailnet only (Tailscale Serve) dcp tailscale on --public # anyone with a link (Tailscale Funnel, the default) dcp tailscale on --https-port 8443 dcp tailscale off # dcp's entry is removed, the links stop working ``` | | Funnel (the default, `--public`) | Serve (`--tailnet`) | | --- | --- | --- | | Who can open the link | anyone on the internet | your devices and people on your Tailscale network | | Webhooks from Stripe, GitHub, Slack | yes | no: they are outside your network | | Your phone, a teammate | yes | yes, with Tailscale on their device | | HTTPS port | 443, 8443 or 10000 | any | | Extra setup | Funnel allowed in the admin console ([Install](/installation#3-tailscale-for-online-links)) | none | Without the boot service (Windows, or a machine where you don't install it), `dcp start` shares Tailscale from the terminal while it runs: Ctrl-C takes the links down, and `dcp start --bg` keeps it running detached (logs in `./dcp.log`). The desktop app shares by itself in that case. Cloudflare needs the local HTTPS proxy. ## Cloudflare Off by default. Every app gets a public link under a domain in your Cloudflare account, through a Cloudflare Tunnel: nobody needs Tailscale, and the link has no path prefix, so the app sees the same paths as on `localhost`. ``` https://web-bigfoot.example.com │ │ └ the zone: a domain in your Cloudflare account │ └ this machine's name (its Tailscale name, else its host name) └ the app's local name, dots as dashes (api.acme → api-acme) ``` Turn it on once, with a token in an env file (or `--token-stdin`): ``` $ dcp cloudflare on --zone example.com --env-file .env → checking the API token from .env: zone example.com, its tunnels and DNS… ✓ API token works: zone example.com (active) in the account Acme ✓ saved them to /Users/you/.dcp/secrets.json (only you can read it) ✓ cloudflare on: every app at -bigfoot.example.com (e.g. https://web-bigfoot.example.com) → the local HTTPS proxy sets up the tunnel dcp-bigfoot, a DNS record per app and the connector (dcp logs -f shows each step)… ✓ tunnel dcp-bigfoot: healthy, 4 connections, 3 apps → checking each link from the outside (DNS via 1.1.1.1, the certificate, the answer); new records take up to a minute… ✓ https://api-bigfoot.example.com 200 · certificate Google Trust Services, valid until 2027-02-20 ✓ https://docs-bigfoot.example.com 200 · certificate Google Trust Services, valid until 2027-02-20 ✓ https://web-bigfoot.example.com 200 · certificate Google Trust Services, valid until 2027-02-20 ✓ tailscale online https://bigfoot.tail1234.ts.net, anyone with a link (3 apps) ✓ cloudflare online https://*-bigfoot.example.com, anyone with a link (3 apps) Every app with its links: dcp ls, or https://dcp.localhost ``` Each step goes to stderr, so stdout stays the result. dcp checks the credentials (an API token first, then a Global API Key with its email), saves what works to `~/.dcp/secrets.json`, saves the settings, and waits for the local HTTPS proxy to bring the tunnel up. Then it opens each link from the outside. Running it again is safe. What the proxy sets up, and keeps in place: - **The tunnel** `dcp-`, managed from Cloudflare's side (no local tunnel config). Its one ingress rule sends everything to dcp's host router on `127.0.0.1:` (`18444` with the default `port` 18443), which picks the app by hostname and presents the request as a local one, as the Tailscale path router does. - **One DNS record per app:** a proxied CNAME to `.cfargotunnel.com`, with the comment `dcp `. dcp deletes only records that point at its own tunnel, and leaves a hostname alone when someone else already has a record for it (it says which, and the fix). - **The connector** `cloudflared`: the one on your `PATH`, else a copy downloaded into `~/.dcp/tools`, checked against the release's SHA-256. Its log is `~/.dcp/logs/cloudflared.log`. The tunnel and DNS are checked every 5 minutes and whenever the set of apps changes; the tunnel's health every 30 seconds. `dcp logs` shows each step: `cloudflare: tunnel created`, `DNS record added`, `cloudflared installed`, `connector started`, `tunnel healthy`. ```bash dcp cloudflare sync # sync now instead of within 5 minutes (dcp reload does it too) dcp cloudflare off # stops the connector; the tunnel and DNS stay, so on again is fast dcp cloudflare on # on again, with the saved zone and credentials dcp cloudflare off --purge # also deletes the tunnel and the DNS records dcp made dcp cloudflare off --forget # also deletes the saved credentials ``` What dcp made in Cloudflare and how it last saw it (zone, tunnel and its health, the DNS records, which credentials work, when it last synced, the last error) is in `~/.dcp/cloudflare.json`. `dcp status` prints it under the Cloudflare line, `dcp status --json` has it, and the dashboard and the desktop app show it. The hostname comes from `cloudflareHost` (default `{app}-{machine}`; [Configuration](/configuration)). One subdomain level, as the default gives, is covered by Cloudflare's free Universal SSL certificate. `{app}.{machine}` puts each app two levels deep, which needs Advanced Certificate Manager or Total TLS on the zone: ```bash dcp cloudflare on --zone example.com --host '{app}-{machine}' ``` Cloudflare links are always public, so a project whose config says `"share": "private"` stays off Cloudflare. ### The Cloudflare token Cloudflare has two ways to sign in to its API, and dcp takes either; it says which it uses, and checks it: | Credentials | What | dcp checks | | --- | --- | --- | | **API token**, user (`cfut_…`) or account-owned (`cfat_…`) | Scoped to the permissions and zones you pick; can expire or be limited to IPs. Cloudflare's recommendation | that it is active, and when it expires (`/user/tokens/verify` or `/accounts//tokens/verify`) | | **Global API Key** (`cfk_…`) with your account's email | Legacy: everything your user can do, on every zone. One per user, no expiry | that it can reach the zone | For a token, create one at [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens) (an account-owned token: the account's **Manage Account › API Tokens**) with two permissions, for the zone the links go under ([Cloudflare's guide](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/)): | Permission | For | | --- | --- | | Account › Cloudflare Tunnel › Edit | the tunnel `dcp-` and its connector token | | Zone › DNS › Edit | one CNAME per app | Put it in an env file and pass it once; dcp keeps what works in `~/.dcp/secrets.json`, readable only by you: ```bash echo 'CLOUDFLARE_API_TOKEN=…' > .env dcp cloudflare on --zone example.com --env-file .env echo "$TOKEN" | dcp cloudflare on --zone example.com --token-stdin # or from stdin ``` The env file can hold the Global API Key instead (`CLOUDFLARE_API_KEY` with `CLOUDFLARE_EMAIL`); with both, dcp tries the token first and falls back to the key, saying which works. `CLOUDFLARE_API_TOKEN` (or the key and email) in the environment overrides what is saved. To move from the Global API Key to a token, run `dcp cloudflare on --env-file` again with the token in the file. ### What dcp shows, and how often it asks Cloudflare ``` $ dcp cloudflare Cloudflare ✓ online · https://*-bigfoot.example.com · anyone with a link · 6 apps credentials user API token, saved in ~/.dcp/secrets.json token active, expires 2027-06-30 (in 213 days) zone example.com · account Acme tunnel dcp-bigfoot · healthy · yyz04, yyz03, yyz06 · id 7918d3a1-… connector cloudflared 2026.11.2 · pid 33352 · up 2h heartbeat: ready, 4 connections, 3s ago DNS 6 records: … sync synced 2m ago, next in 3m API 4 of 300 calls in the last 5 minutes (Cloudflare allows 1200 per user) dashboard DNS …/dns/records · tunnels …/networks/tunnels ``` The heartbeat comes from `cloudflared` itself (its `/ready` on this machine), every few seconds, without the API. Cloudflare's API allows 1,200 calls per 5 minutes per user, counted across the dashboard and every token, and blocks the user for 5 minutes past it, so dcp spends little: it looks the zone, account and tunnel up once and keeps their IDs, sets the tunnel's ingress and reads its token only when they change, checks a token's status hourly, and in a steady state makes two calls every 5 minutes (the tunnel's status and the DNS records), more only when the apps change or `dcp cloudflare sync` asks. It keeps itself to 300 calls per 5 minutes, and when Cloudflare answers 429 it stops for as long as `Retry-After` says. A tunnel deleted in the dashboard is made again, and dcp's own DNS records (they carry the comment `dcp `) move to it. ## Check the links ``` $ dcp check ✓ https://bigfoot.tail1234.ts.net/api/ 200 · certificate Let's Encrypt, valid until 2027-01-14 ✓ https://api-bigfoot.example.com 200 · certificate Google Trust Services, valid until 2027-02-20 … https://web-bigfoot.example.com http: answers 530 (the tunnel is not connected yet) ``` It opens every link online from the outside, the way a browser elsewhere would: DNS asked of 1.1.1.1 (no cache on this machine hides a new record), the TLS certificate (who issued it, until when) and the HTTP answer. It exits 1 when one fails; `--json` prints each result with the step that failed. ## When a link does not open `dcp status`, `dcp doctor`, the dashboard and the desktop app say what is wrong and the one step that fixes it. | Problem | Fix | | --- | --- | | Tailscale: signed out | `tailscale up` | | Tailscale: Funnel not allowed in your tailnet | the admin page Tailscale names ([Install](/installation#3-tailscale-for-online-links)), or `dcp tailscale on --tailnet` | | Tailscale: changing Serve needs root (no operator) | `sudo tailscale set --operator=$USER` | | Tailscale: another Serve entry on the same port | free it (`tailscale serve status`, `tailscale serve reset`), or `dcp tailscale on --https-port 8443` | | Cloudflare: credentials refused, or the zone is not visible | a token with [the two permissions](#the-cloudflare-token) for that zone | | Cloudflare: a hostname already has a DNS record dcp did not make | change `cloudflareHost` (`dcp cloudflare on --host …`), or remove that record | | Cloudflare: `cloudflared` exits | its log, `~/.dcp/logs/cloudflared.log` | | Cloudflare: the link answers 530 or 502 | the tunnel is not connected yet: wait a few seconds, then `dcp check` | | A port dcp needs is taken (the routing proxy's `port`, or the next one for the tunnel) | `dcp configure --port ` (the tunnel uses the next one) | | The local HTTPS proxy is not running | `dcp service install` (Tailscale only: or `dcp start` in a terminal) | | A 404 from dcp | no dev server for that project runs: `dcp ls` | ## What gets found Dev servers listening in the port range (3000–6000 by default) whose process is a web runtime: Node, Bun, Deno, Python (uvicorn, gunicorn), Ruby, PHP, `go run`, Java, .NET, Elixir, Perl, and Docker-published ports with `--docker`. ```bash dcp ls # what is (or would be) shared, with each link dcp configure --ports 3000-9000 # a wider range dcp configure --all # every listener in the range, compiled binaries included ``` The project name is the folder that holds the nearest `package.json`, `go.mod`, `pyproject.toml`, `Cargo.toml` or `.git`. If one folder runs two servers, the lower port gets `//` and the other `/-/`, and `dcp ls` shows both. A project can choose its own path and whether it is shared, in the same config that names it locally ([Pick the name](/local-https#pick-the-name)): ```json { "name": "api.acme", "path": "api", "share": "private" } ``` `share: "private"` keeps it to your tailnet even while Tailscale sharing is public (Funnel callers get a 404 and never see it listed), and off Cloudflare. `share: false` leaves it out of both providers. ## What your app sees Requests arrive the way they would on localhost: `Host: localhost:`, and through Tailscale the `/` prefix removed, so CORS, cookies and host allow-lists behave as they do locally. Apps that build absolute URLs from the request (OAuth redirect URIs, canonical links) want the public host instead: ```bash dcp --forward-host # X-Forwarded-Host and X-Forwarded-Proto: https reach the app ``` Server-sent events stream and WebSockets upgrade, so hot reload works through the link too. ## A real setup Four services of one product, each in its own folder: ```bash cd ~/work/acme/services/agent && bun run dev # :3087 cd ~/work/acme/services/crawler && bun run dev # :3120 cd ~/work/acme/services/workspace && bun run dev # :3122 cd ~/work/acme/apps/web && npm run dev # :4501 dcp ls | grep tailscale ``` ``` agent 3087 tailscale online https://bigfoot.tail1234.ts.net/agent/ crawler 3120 tailscale online https://bigfoot.tail1234.ts.net/crawler/ workspace 3122 tailscale online https://bigfoot.tail1234.ts.net/workspace/ web 4501 tailscale online https://bigfoot.tail1234.ts.net/web/ ``` Next: point a webhook or an OAuth callback at one of them, in [Webhooks & OAuth callbacks](/webhooks). # Webhooks & OAuth callbacks Payment providers, Git hosts, chat platforms and sign-in providers need a URL on the internet that reaches your code. With dcp that URL points at your laptop, and it stays the same: register it once, and it works every day you run `dcp`. `https://bigfoot.tail1234.ts.net/api/webhooks/stripe` - `https://bigfoot.tail1234.ts.net`: Your machine. Same name tomorrow, after a reboot, on another network. - `/api/`: The project folder of the dev server that should receive it. - `webhooks/stripe`: Your app's own route, unchanged. ## The workflow 1. Start the app that receives the call, as usual. 2. Sharing is on by default (public: the provider is outside your Tailscale network). `dcp ls` prints each link, and `dcp url api --tailscale` just one. 3. Paste `https://..ts.net//` into the provider's settings. Once. 4. Trigger the event. The request reaches your app with its body and headers untouched, so signature checks pass. A [Cloudflare](/share#cloudflare) link, `https://-.`, is a stable public URL too, under your own domain and with no path prefix, and works with any of these services: `dcp url api --cloudflare` prints it. The link stays up while the machine is on, after reboots too: the local HTTPS proxy keeps sharing. When the app is stopped, the provider gets an error and retries later, as it would with a deployed site that is down. ## Examples Dashboard: Developers, Webhooks, Add endpoint. ``` Endpoint URL https://bigfoot.tail1234.ts.net/api/webhooks/stripe ``` Your handler verifies `Stripe-Signature` with the endpoint's signing secret, as in production. With the Stripe CLI you'd run `stripe listen` in every session and get a new secret each time; this endpoint and its secret stay. Repository or app settings, Webhooks. ``` Payload URL https://bigfoot.tail1234.ts.net/api/webhooks/github Content type application/json ``` "Recent deliveries" in the same settings page shows each attempt and lets you redeliver one while you fix the handler. App settings: Event Subscriptions (Request URL) and Interactivity. ``` Request URL https://bigfoot.tail1234.ts.net/api/slack/events ``` Slack sends a challenge when you save the URL, so `dcp` and the app must be running at that moment. Register the callback as an authorized redirect URI, next to production's. ``` Google https://bigfoot.tail1234.ts.net/web/auth/callback/google GitHub https://bigfoot.tail1234.ts.net/web/auth/callback/github ``` Run `dcp --forward-host` so the app sees the public host (`X-Forwarded-Host`, `X-Forwarded-Proto: https`) and builds the same redirect URI it registered; without it the app sees `localhost` and the provider rejects the mismatch. ## When the provider can't reach it | What you see | Why | Fix | | --- | --- | --- | | Timeout, connection refused | sharing is off, tailnet-only (Serve), or not online | `dcp status` names the fix; `dcp tailscale on --public` (Stripe or GitHub is never on your tailnet), or a Cloudflare link ([When a link does not open](/share#when-a-link-does-not-open)) | | 404 from dcp | no dev server for that project is running | start it; `dcp ls` shows the project names | | 502 | the app is starting, or crashed | check the app's own logs | | OAuth: redirect URI mismatch | the app built a `localhost` redirect | `dcp --forward-host` | | The URL changed | the machine was renamed in Tailscale (both links carry its name) | rename it back in the admin console, or update the provider | | Not sure it answers from outside | a new link, or a changed setting | `dcp check`: DNS, certificate and status of every link | More in [Troubleshooting](/troubleshooting). # Use with AI agents Coding agents start dev servers, call them and hand you links. With dcp they use names instead of ports, find what runs with one command, and give you a link you can open from anywhere. ## Give an agent the prompt Paste this at the start of a session, before asking an agent to run, test or share an app. ```text You are working in a project whose dev servers run through dev-code-proxy (dcp). Use it instead of raw ports. Check the machine first, and fix what is missing: - `dcp --version` (missing: `brew install meabed/tap/dcp` or `npm i -g dev-code-proxy`) - `dcp doctor` checks both halves and each sharing provider; each ✗ is followed by the command that fixes it, and it exits 1 when one fails. - `dcp service install` fixes local HTTPS; it may ask the user for their password once, so tell them. - Tailscale sign-in and Funnel are the user's to do in a browser; give them the link doctor prints. Run an app at a local HTTPS name: - Start the dev server the usual way (npm run dev, uvicorn, rails s, go run .): dcp finds it and serves it at https://.localhost. Never hard-code a port. - To pick the name, put it in the project: .dcp.json { "name": "." }, or the "dcp" key of package.json / deno.json, [tool.dcp] in pyproject.toml, [package.metadata.dcp] in Cargo.toml, "extra"."dcp" in composer.json. - `dcp ls --json` lists every app and link, one entry each (name, port, pid, source "found" or "run", dir, provider local/tailscale/cloudflare, url, state up/online/not shared/exited, public); https://dcp.localhost/api/status has them with requests and latency. - A port is taken by a dev server left running: `dcp stop ` or `dcp stop `, with --yes (there is no terminal to ask in) and --force when it ignores SIGTERM. Stop only servers you started, unless the user says so. - To run a command through dcp instead (it picks a free port and sets $PORT and $HOST): `dcp run -- ''`, e.g. `dcp run api.acme -- 'uvicorn main:app --port $PORT --host $HOST'`. Share an app online (webhooks, OAuth callbacks, a phone, a teammate): - Sharing is on by default: the local HTTPS proxy keeps every dev server online through Tailscale (Funnel), after reboots too. `dcp url --tailscale` (or `--cloudflare`) prints just that URL, e.g. `curl $(dcp url api --cloudflare)/health`; it exits 1 when the link is not online yet. - `dcp status --json` says per provider whether it is on and online, and otherwise the problem, the fix and a docs link; `dcp check` opens every link from the outside (DNS, certificate, HTTP status). Run the fix it names, or hand it to the user when it is theirs (a sign-in, an admin page). - Cloudflare (a public link under the user's own domain) is off until set up once: `dcp cloudflare on --zone --env-file `. The token needs Account › Cloudflare Tunnel › Edit and Zone › DNS › Edit; ask the user for it, never invent one. - `dcp tailscale on --tailnet` limits Tailscale to the tailnet (Serve); `dcp tailscale off` and `dcp cloudflare off` turn them off. Change these only when the user asks. - The URL is the same every time on this machine, so register it once with Stripe, GitHub, Slack or an OAuth provider. - Apps see Host: localhost by default; use `dcp --forward-host` when the app builds absolute URLs (OAuth redirects). Report the URLs you used. Docs for agents: https://dev-code-proxy.com/llms-full.txt ``` ## Keep it in the repo Add this section to the project's `AGENTS.md` (or `CLAUDE.md`), so every session knows it without being told. ```markdown ## Local URLs (dev-code-proxy) - Start apps as usual: dcp finds every dev server and serves it at https://.localhost, named by the project's .dcp.json or "dcp" config (default: its folder). Never hard-code ports. https://dcp.localhost shows what runs. - First run on a machine: `dcp service install` (local HTTPS proxy from boot + trusted CA). `dcp service status` checks it. - Running apps and every link: `dcp ls --json`; stop one: `dcp stop --yes`. One URL for a webhook or callback (shared by default): `dcp url --tailscale` or `--cloudflare`. - Sharing online: `dcp status --json` (each provider, or the problem and its fix), `dcp check` (each link from the outside). Cloudflare setup, once: `dcp cloudflare on --zone --env-file .env`. - Docs: https://dev-code-proxy.com/llms-full.txt ``` ## Docs an agent can read | URL | What | | --- | --- | | [`/llms.txt`](/llms.txt) | What dcp is and a link to each page, in the [llms.txt](https://llmstxt.org) format | | [`/llms-full.txt`](/llms-full.txt) | Every page of these docs as one Markdown file | ## Commands agents rely on | Command | Gives the agent | | --- | --- | | `dcp service status` | three ✓/✗ lines and exit 1 when local HTTPS isn't ready | | `dcp ls --json` | one entry per app and link: `name`, `port`, `pid`, `source` (`run` or `found`), `dir`, `provider` (`local`, `tailscale`, `cloudflare`), `url`, `state` (`up`, `online`, `not shared`, `exited`), `public` | | `dcp url --cloudflare` | just that URL (or `--tailscale`, `--local`), for `curl $(dcp url api --cloudflare)`; exit 1 when it is not online yet | | `dcp stop --yes` | the app behind a name or port stopped (SIGTERM, waits 5s; `--force` at once); exit 1 when it still runs | | `dcp run -- ` | an app at `https://.localhost`, with `PORT` and `HOST` set for it | | `dcp status --json` | each provider: `on`, `online`, `base`, and when it is not online the `problem`, `fix` and `docs`; exit 1 when one that is on is not online | | `dcp check --json` | every online link opened from the outside: DNS, certificate (issuer, expiry), HTTP status, and the step that failed | | `dcp doctor` | what either half is missing, each ✗ with the command that fixes it; exit 1 when one fails | Every command prints what to do next when something is off, so an agent can recover without guessing. Commands that need the user (a password for `dcp service install`, a Tailscale sign-in, a Cloudflare token) say so. # Dev Code Proxy for desktop A native menu-bar app for `dcp`: share your dev servers online, see every app with its links, CPU and memory, stop one, and change any setting, without a terminal. macOS — Apple Silicon & Intel.dmg Windows — 64-bit.zip Linux — 64-bit.tar.gz Direct downloads from the latest release. Also see [all releases](https://github.com/meabed/dev-code-proxy/releases). ## What it does One native menu in the menu bar (the system tray on Windows and Linux): no window to manage, and it looks and behaves like the rest of your system's menus, dark mode and keyboard included. ``` Sharing online ● Tailscale: anyone with the link · 2 apps ▸ https://laptop.tail1234.ts.net (click copies) Anyone with the Link (Funnel) · My Tailnet Only (Serve) Turn Tailscale Sharing Off Help: How Tailscale Sharing Works ○ Cloudflare: off ▸ Set Up: Copy “dcp cloudflare on --zone example.com --env-file .env” Help: How Cloudflare Sharing Works ───────────── This Mac · 3 apps api.acme.localhost :4100 0.4% · 96 MB ▸ Open: https://api.acme.localhost https://laptop.tail1234.ts.net/api/ https://api-acme-laptop.example.com (not online) http://127.0.0.1:4100 Copy: Local URL · Tailscale Link · Cloudflare Link · All Details Process: dcp run · port 4100 · pid 5120 (click copies) 0.4% CPU · 96 MB · 2 processes · up 1h02m ~/acme/api (opens the folder) Stop… Open Dashboard · Rescan Now · Restart Local Proxy ───────────── Settings ▸ every setting of ~/.dcp/config.json Check for Updates… Documentation About Quit ``` - **Sharing online**, one row per provider with a status dot: Tailscale (on by default) and Cloudflare. Each row's submenu has the base URL to copy, the detail (the Cloudflare tunnel's health), and while it is not online the problem with its **Fix** (a page to open, or a command to copy). Tailscale picks a public link (Funnel) or your tailnet only (Serve); each provider turns on or off; Cloudflare's **Set Up** copies `dcp cloudflare on --zone example.com --env-file .env`, to run once in a terminal. Cloudflare's row also shows which credentials work, the zone, its DNS records and the last sync, with **Sync Now**; once it is off, **Delete Tunnel and DNS Records…** and **Forget Credentials…** (each asks first). **Check Links…** opens every link from the outside and says how each answered (DNS, certificate, status). **Help** opens the docs for that provider. The local HTTPS proxy keeps sharing after reboots; on a machine without it, the app shares Tailscale by itself while it runs. - **Every app with its links.** Each `https://.localhost` app of this machine shows its port, CPU and memory in the menu, and has a submenu in three sections: **Open** (its `.localhost` name, its Tailscale and Cloudflare links, `127.0.0.1:`), **Copy** (Local URL, Tailscale Link, Cloudflare Link, All Details) and **Process** (runtime, pid, CPU, memory, processes, uptime and folder, readable, a click copies a line). The numbers update while the menu is open. A link whose provider is off or not online yet is marked *not online*, and clicking it offers to turn that provider on. - **Rescan Now and Restart Local Proxy:** `dcp reload` and `dcp restart`, from the menu. - **Stop an app** the way [`dcp stop`](/local-https#stop-an-app) does. The confirmation shows the process, what it costs and the exact command, with **Stop** (SIGTERM, like Ctrl-C), **Force Stop** (ends every process of it at once) and **Copy Command**. One that is still running after 5 seconds offers Force Stop. - **Every setting in the menu**, grouped: finding dev servers (ports, runtimes, Docker, scan interval), Tailscale (HTTPS port, forwarded host, MagicDNS), the local HTTPS names (finding dev servers, the dashboard, names nothing serves, the request log, automatic updates), and the app (open at login). A change applies at once, and `dcp configure` in a terminal shows up in the menu. - **Says what's missing.** Tailscale not installed or not signed in, or local HTTPS not set up: the first rows say so, with the link or the command to copy. ## Install ### macOS 1. Open the `.dmg` and drag **Dev Code Proxy** into **Applications**. 2. The app isn't notarized yet, so the first launch needs a one-time bypass — **right-click the app → Open → Open**, or run: ```bash xattr -dr com.apple.quarantine "/Applications/Dev Code Proxy.app" ``` 3. It launches into the **menu bar** (no Dock icon). Click the icon for its menu. ### Windows Unzip and run `DevCodeProxy.exe`. It's unsigned, so SmartScreen may warn — **More info → Run anyway**. The icon appears in the system tray. ### Linux ```bash tar xzf Dev-Code-Proxy-Linux.tar.gz sudo apt install libgtk-4-1 libwebkitgtk-6.0-4 # one-time runtime deps ./dev-code-proxy ``` The app needs [Tailscale](https://tailscale.com/download) installed and signed in (`tailscale up`). For public sharing, enable **Funnel** — see [Installation](/installation). Prefer the terminal? The [CLI](/commands) does everything the app does. ## Build from source ```bash git clone https://github.com/meabed/dev-code-proxy cd dev-code-proxy/desktop && go build -o dcp-app . && ./dcp-app ``` Needs Go 1.26+ and a C toolchain (Xcode CLT on macOS; `libgtk-4-dev` + `libwebkitgtk-6.0-dev` on Linux). See [`desktop/README.md`](https://github.com/meabed/dev-code-proxy/blob/master/desktop/README.md). # Commands Every command prints what to do next when something is off. `dcp --help` lists its flags; `-v` prints the version. ## Both halves | Command | What it does | | --- | --- | | `dcp doctor` | Check Tailscale, each sharing provider and local HTTPS; each ✗ with the command that fixes it, and the dashboard link; exit 1 when one fails | | `dcp ls [pattern] [--json]` | One line per app and link: `NAME PORT PROVIDER STATE URL`, the provider `local`, `tailscale` or `cloudflare`, the state `up`, `online`, `not shared` or `exited`; the pattern keeps apps whose name, folder or URL has it | | `dcp url [--local\|--tailscale\|--cloudflare]` | Just the URL (`curl $(dcp url api --cloudflare)`); without a flag the best one online (Cloudflare, Tailscale, local); exit 1 when it is not online yet | | `dcp open [--local\|--tailscale\|--cloudflare]` | Open that URL in the browser | | `dcp update` | Update to the latest release, the way dcp was installed (brew, npm or the binary itself, checksum-verified) | | `dcp stats [--since 24h] [--json]` | How the local proxy runs: health, updates, and requests, failures and p50/p95/p99 per name ([Logs and stats](/logs-and-stats)) | | `dcp logs [-n 40] [-f] [--json]` | The local proxy's events: starts, live updates, rollbacks, failed or slow requests | | `dcp uninstall [--yes] [--all]` | Remove everything dcp set up: the Tailscale entry it created, the boot service, the CA and `~/.dcp`; `--all` also the config and a standalone binary | ## Local HTTPS names | Command | What it does | | --- | --- | | (nothing) | Every dev server found gets `https://.localhost`: its folder's name, or `name` from its project config ([Local HTTPS names](/local-https#start-your-app-as-usual)) | | `dcp run` | Run the app in this folder from package.json or `.dcp.json` `"dcp": { "name", "script" }` | | `dcp run -- ''` | Run any command at `https://.localhost`; one quoted string runs through the shell, after `PORT` and `HOST` are set | | `dcp run --force` | Take a name over from a run in another terminal | | `dcp restart` | Restart the local HTTPS proxy: a fresh copy takes over live, no sudo, no dropped request ([Restart or reload](/local-https#restart-or-reload)) | | `dcp reload` | Read the settings again and look for dev servers now | | `dcp stop ` | Stop the app behind a name, or what listens on a port: SIGTERM (Windows: `taskkill /T`), like Ctrl-C; asks first. `--force` ends it and every process it started at once (a hung app), `--pid ` stops one process, `--yes` skips the question ([Stop an app](/local-https#stop-an-app)) | | `dcp configure --discover=false` | Stop finding dev servers; only `dcp run` names remain | | `dcp configure --catch-all` | Answer every `.localhost` name: one nothing serves shows what runs (default off: no answer) | | `dcp configure --dashboard=false` | Turn `https://dcp.localhost` off (default on) | | `https://dcp.localhost` | The dashboard: what runs, requests and latency per name, CPU and memory and a Stop button per app, the proxy's state (JSON at `/api/status`) | | `dcp service install` | Once per machine (your password once): the proxy from boot, its CA trusted; it updates itself afterwards. Safe to repeat | | `dcp service status` | Three ✓/✗ lines; exit 1 when one is off | | `dcp service uninstall` | Stop and remove the boot service | | `dcp trust` | Trust the local CA only | | `dcp proxy [--port n]` | The proxy in the foreground (what the boot service runs) | ## Online links | Command | What it does | | --- | --- | | `dcp status [--json]` | Each provider: online, not online with the problem, its fix and a help link, or off with the command that turns it on; exit 1 when a provider that is on is not online ([Share online](/share)) | | `dcp check [--json]` | Open every online link from the outside: DNS via 1.1.1.1, the TLS certificate (issuer, expiry), the HTTP status | | `dcp tailscale on [--tailnet\|--public] [--https-port 443]` | Share through Tailscale: Funnel (`--public`, the default) or Serve (`--tailnet`) | | `dcp tailscale off` | Stop sharing through Tailscale (dcp's Funnel or Serve entry is removed) | | `dcp cloudflare on --zone example.com [--env-file .env \| --token-stdin] [--host '{app}-{machine}']` | Share through a Cloudflare Tunnel: checks the credentials, saves them, waits for the tunnel, a DNS record per app and the connector, then checks each link ([Cloudflare](/share#cloudflare)) | | `dcp cloudflare sync` | Sync now: the tunnel, a DNS record per app, the connector (otherwise every 5 minutes and when the apps change) | | `dcp cloudflare off [--purge] [--forget]` | Stop the connector; `--purge` also deletes the tunnel and the DNS records dcp made, `--forget` the saved credentials | | `dcp` | With the local HTTPS proxy running: what `dcp status` prints (sharing is on by default) | | `dcp start [flags]` | The same; without the boot service, share Tailscale from this terminal (Ctrl-C ends it, `--bg` detaches) | | `dcp configure [flags]` | Save flags as defaults in `~/.dcp/config.json` | ## `start` flags `dcp start` shares from the terminal only without the boot service. Defaults come from your config file (see [Configuration](/configuration)). | Flag | Default | Meaning | | --- | --- | --- | | `--ports ` | `3000-6000` | Port range **or a single port** to scan | | `--all` | off | Include all listeners, not just web runtimes | | `--runtimes ` | all known | Restrict to specific runtimes, e.g. `node,bun,python` | | `--docker` | off | Also discover Docker containers via the local Docker API (read-only) | | `--private` | config `private` | This terminal share through Tailscale **Serve** (default: **Funnel**) | | `--bind ` | `127.0.0.1` | Listen address; `0.0.0.0` to reach from containers/LAN | | `--port ` | `18443` | Local proxy HTTP port (never a Funnel port: Tailscale.app's Serve binds that port on every address) | | `--interval ` | `20` | Re-scan period | | `--https-port ` | config `httpsPort` | This terminal share's HTTPS port (Funnel: `443`/`8443`/`10000`) | | `--deregister-cycles ` | `5` | Missing scans before a gone service is removed | | `--forward-host` | off | Forward the public host to apps via `X-Forwarded-Host/Proto` (default: local) | | `--match-separators` | on | Route `/a-b/` and `/a_b/` alike; `--match-separators=false` for exact-dash | | `--accept-dns ` | unset | Optionally `tailscale set --accept-dns` on start; `false` lets a tailnet host resolve the public funnel name (persists) | | `--bg` | off | Run detached (logs → `./dcp.log`) | | `--proxy-only` | off | Run the proxy only; print the `tailscale` command | | `--log-requests` | on | Log each proxied request | | `--quiet` | off | Disable per-request logging | ## Startup output On start, `dcp` prints the effective parameters and logs discoveries: ``` Using config: /Users/me/.dcp/config.json ports=3000-6000 mode=public (Funnel) proxy=127.0.0.1:18443 https=443 interval=20s runtimes=default (…) deregister-after=5 scans log-requests=true host=local (apps see localhost) 2026/05/31 02:05:48 discovered web node :4983 pid 15588 ~/work/help-ai/apps/web 2026/05/31 02:05:49 200 GET /web/ → 127.0.0.1:4983 (6ms) ``` Request logs are colorized by status on a terminal (set `NO_COLOR` to disable). ## One-liners ```bash dcp ls # every app with each link dcp ls api | grep cloudflare # one app's Cloudflare link dcp tailscale off; dcp cloudflare off # take every link down dcp --ports 4000 # scan a single port dcp --interval 5 # faster pickup of new servers dcp --proxy-only # local proxy only; print the tailscale command dcp --bg # run detached; logs → ./dcp.log dcp --forward-host # send the public host to apps dcp --match-separators=false # exact-dash routing (default treats - and _ alike) ``` # Configuration These are your machine's settings. A project's own (its name, port, whether to share it) live in the project, in `.dcp.json` or the `dcp` key of the manifest it already has: [Pick the name](/local-https#pick-the-name). `dcp configure [flags]` writes `~/.dcp/config.json` (created on first use). Flags always override the config for a single run; the file is the source of defaults, and a bare `dcp` runs `start` with it. ```bash dcp configure --ports 3000-9000 --runtimes node,bun,python dcp tailscale on --tailnet # sharing settings: dcp status (Share online) ``` Sharing online is set with `dcp status`, which saves the same file and waits for the local HTTPS proxy to apply it ([Share online](/share)). Each run takes the built-in defaults, then the file, then the flags you pass, so a flag always wins for that run. ## File format ```json { "ports": "3000-6000", "all": false, "runtimes": "", "tailscale": true, "private": false, "httpsPort": 443, "cloudflare": false, "cloudflareZone": "", "cloudflareHost": "{app}-{machine}", "bind": "127.0.0.1", "port": 18443, "interval": 20, "logRequests": true, "deregisterCycles": 5, "forwardHost": false, "matchSeparators": true, "docker": false, "acceptDns": "", "autoUpdate": true, "localRequestLog": "errors", "discover": true, "localDashboard": true, "localCatchAll": false } ``` | Key | Meaning | | --- | --- | | `ports` | Port range (`"3000-6000"`) or a single port (`"4000"`) to scan | | `all` | Include every listener, not just known web runtimes | | `runtimes` | Comma-separated allow-list, e.g. `"node,bun,python"` (empty = all known) | | `tailscale` | Share every dev server online through Tailscale, from the local HTTPS proxy, after reboots too (default on; `dcp tailscale on\|off`) | | `private` | Tailscale: Serve (your tailnet only) instead of Funnel (`dcp tailscale on --tailnet`; `--public` turns it back) | | `httpsPort` | Tailscale: the links' HTTPS port (Funnel: 443 / 8443 / 10000). Default 443 | | `cloudflare` | Share every dev server online through a Cloudflare Tunnel (default off; `dcp cloudflare on --zone …`) | | `cloudflareZone` | Cloudflare: the domain the links are under, a zone in your account, e.g. `example.com` | | `cloudflareHost` | Cloudflare: each app's hostname under the zone (default `{app}-{machine}`): `{app}` is the app's local name with dots as dashes, `{machine}` this machine's Tailscale or host name. One subdomain level is covered by Cloudflare's free Universal SSL; `{app}.{machine}` needs Advanced Certificate Manager or Total TLS | | `bind` | Proxy listen address (`0.0.0.0` to reach it from containers/LAN) | | `port` | The routing proxy's HTTP port (Tailscale forwards to it); the Cloudflare tunnel's host router listens on the next one (default 18443 and 18444) | | `interval` | Re-scan period, seconds | | `logRequests` | Log each proxied request | | `deregisterCycles` | Consecutive missing scans before a service is removed | | `forwardHost` | Forward the public host to apps (`X-Forwarded-Host`/`-Proto`) | | `matchSeparators` | Treat `-` and `_` as interchangeable in the path slug, so `/module-api/` and `/module_api/` both route (default on) | | `docker` | Also discover Docker containers via the local Docker API (read-only, over `/var/run/docker.sock`) | | `acceptDns` | `""` leaves Tailscale DNS alone; `"true"`/`"false"` runs `tailscale set --accept-dns` on start | | `autoUpdate` | The local HTTPS proxy installs new releases itself, checksum-verified, and the CLI says once a day when one is out (default on; `DCP_NO_UPDATE=1` or `CI` turns both off) | | `discover` | The local HTTPS proxy finds dev servers and names them, with no `dcp run` (default on). Each project's own settings live in its config: [Pick the name](/local-https#pick-the-name) | | `localDashboard` | `https://dcp.localhost` is the dashboard: what runs, CPU, memory, requests, a Stop per app (default on; `dcp configure --dashboard=false` turns it off) | | `localCatchAll` | A `.localhost` name nothing serves gets a page listing what runs and how to start an app there (default off: no answer, as if nothing listened; `dcp configure --catch-all` turns it on) | | `localRequestLog` | What the local HTTPS proxy logs per request: `"errors"` (failed, 5xx, over 2 s; the default), `"all"` or `"off"` ([Logs and stats](/logs-and-stats)) | The local HTTPS proxy reads `discover`, `localDashboard`, `localCatchAll` and `localRequestLog` as they change (within a second), the sharing settings within seconds, and `ports`, `runtimes`, `all` and `docker` on its next scan: no restart. A running `dcp` reads its settings when it starts; the desktop app restarts its sharing when you change one in its menu. ## Host header behavior By default `dcp` presents a **local** request to your app: `Host: localhost:`, the `//` prefix stripped, and `X-Forwarded-For` preserved — so the app behaves exactly like it does on `localhost` (CORS, cookies, host-allowlists all match). Set `forwardHost: true` (or `--forward-host`) to surface the public host via `X-Forwarded-Host` + `X-Forwarded-Proto: https` for apps that need the public URL (OAuth callbacks, canonical links). ## Slug separators Slugs are canonically dash-separated. With `matchSeparators` on (the default), `dcp` folds `_` to `-` when an exact route lookup misses, so `/module_api_foo/` and `/module-api-foo/` reach the same dev server. Set `matchSeparators: false` (or `--match-separators=false`) to route only the exact dash form. ## Files Everything dcp keeps is in `~/.dcp`; `dcp uninstall` removes it. | Path | What | | --- | --- | | `config.json` | the settings on this page | | `cloudflare.json` | what dcp made in Cloudflare and how it last saw it: zone, tunnel and its health, DNS records, credentials, last sync and error | | `secrets.json` | the Cloudflare credentials that work (`cloudflareToken`, or `cloudflareKey` with `cloudflareEmail`), readable only by you; `CLOUDFLARE_API_TOKEN` (or `CLOUDFLARE_API_KEY` with `CLOUDFLARE_EMAIL`) in the environment overrides it | | `tools/` | `cloudflared`, when it is not on your `PATH` (downloaded and checksum-verified) | | `ca/` | the local certificate authority (`ca.pem`, and its key readable only by you) | | `routes/` | one file per running `dcp run` name | | `bin/` | the dcp releases the local proxy runs, and `state.json` (which one serves, which were set aside) | | `logs/` | `proxy.jsonl` events, `stats.jsonl` summaries ([Logs and stats](/logs-and-stats)) and `cloudflared.log` | | `run/` | the socket a running proxy answers `dcp stats` on | | `proxy.json`, `update.json` | the running proxy's address and the last release check | | `online.json` | what is shared online now, per provider (by the proxy, a terminal `dcp start` or the desktop app), or why it is not | # Logs and stats The local HTTPS proxy keeps a short record of what it does and how fast it answers, so you can see how it ran yesterday or after an update without turning anything on. It costs a few counters per request and one summary line a minute. ## How it is running ```bash dcp stats # the proxy now, and requests per name in the last 24h dcp stats --since 1h # a shorter window (or 7d) dcp stats --json # the same for scripts and agents ``` ``` Local HTTPS proxy (https://*.localhost) serving dcp 1.14.0, pid 4321 (worker), up 3h12m; boot service 1.14.0, pid 4300, since Nov 27 15:10 process 18 MB, 41 goroutines, 3 open connections, CPU 12.3s, 4 certificates issued changes 0 live updates, 0 set aside, 0 crashes updates auto-update on (checked 1h20m ago, latest 1.14.0) Requests per name, last 24h NAME REQUESTS FAILED 4XX 5XX P50 P95 P99 api.acme 1204 0 3 0 10ms 100ms 250ms ``` P50, P95 and P99 are the time to the first byte of your app's answer: half, 95% and 99% of requests were at least that fast. **Failed** counts requests that never reached the app (it was down or not listening on `$PORT`). Names that don't exist are counted together as `(unknown)`. When sharing online runs, `dcp stats` adds the same table for the online side: requests per project through the Tailscale and Cloudflare links. ## What happened ```bash dcp logs # the last 40 events dcp logs -f # follow new ones (Ctrl-C stops) dcp logs -n 200 --json # raw JSON lines ``` ``` Nov 27 15:10:02 INFO supervisor supervisor started pid=4300 port=443 version=1.14.0 Nov 28 09:41:16 INFO supervisor worker ready pid=4300 release=1.15.0 version=1.14.0 worker=5120 Nov 28 09:41:17 INFO supervisor swapped from=1.14.0 pid=4300 to=1.15.0 version=1.14.0 Nov 28 11:03:55 WARN worker request method=GET ms=2410 name=api.acme path=/reports pid=5120 status=200 upstreamFailed=false version=1.15.0 ``` Events: starts and stops, live updates and rollbacks, update checks, and requests that failed, answered 5xx or took over 2 seconds. Sharing online logs its steps and problems too, such as `tailscale: not online`, `cloudflare: tunnel created`, `cloudflare: DNS record added`, `cloudflare: cloudflared installed`, `cloudflare: connector started` and `cloudflare: tunnel healthy`. To log every request while you chase a problem, then go back: ```bash dcp configure --local-request-log=all # errors is the default; off logs none dcp configure --local-request-log=errors ``` ## Where it is kept | File | What | Kept | | --- | --- | --- | | `~/.dcp/logs/proxy.jsonl` | events, one JSON object a line | 5 MB, three files | | `~/.dcp/logs/stats.jsonl` | a summary per name each minute with traffic | 5 MB, three files | | `~/.dcp/logs/cloudflared.log` | the Cloudflare connector's own output, while Cloudflare sharing is on | 8 MB, emptied when the connector starts past that | | `/var/log/dev-code-proxy.log` (macOS) | the boot service's own output | until you delete it | | `journalctl -u dev-code-proxy` (Linux) | the same | the journal's settings | Everything stays on your machine. The stats socket a running proxy answers on is in `~/.dcp/run`, readable only by you. # How it works dcp is two independent pieces that end at the same app: a local HTTPS proxy for `*.localhost` names, and the online links: a path-routing proxy behind one Tailscale entry, and, when you turn it on, a host router behind a Cloudflare Tunnel. The local side (the boot service, the route files, the certificate authority) is described in [Local HTTPS names](/local-https#technical-details). This page covers the online side. ## Online: architecture ```mermaid flowchart LR C["Caller
internet or tailnet"] C -->|"https://node.ts.net/web/foo"| TS subgraph machine["your machine"] direction TB TS["tailscale funnel | serve
TLS · :443 / 8443 / 10000"] P["dcp proxy
net/http · :18443"] SCAN["discovery loop
lsof·ps / netstat·tasklist"] D1["127.0.0.1:4983
web · bun"] D2["127.0.0.1:3000
api · node"] TS -->|plain HTTP| P P -->|"/web/foo → strip → /foo
Host → localhost:4983"| D1 P --> D2 SCAN -->|"slug → port map"| P SCAN -.->|"scan every --interval"| D1 SCAN -.-> D2 end ``` One Tailscale entry terminates TLS and forwards plain HTTP to the local `dcp` proxy, which routes by the **first path segment** to the matching dev server. ## Discovery pipeline ```mermaid flowchart TD A["List listeners in port range (with PID)
mac/linux: lsof · ps · cwd · windows: netstat · tasklist"] --> B["Classify runtime
node·bun·deno·python·ruby·php·go·java·dotnet·elixir·docker"] B --> C["Derive slug = nearest project-root folder"] C --> D["Resolve duplicates per folder
lowest port = main · others suffixed by port"] D --> E["RouteStore.refresh
debounced de-register"] E --> F["slug → service map"] ``` Every `--interval` seconds: 1. **List listeners** — TCP sockets in `LISTEN` within the port range, with PID (macOS/Linux via `lsof`+`ps`, Windows via `netstat`+`tasklist`). On macOS/Linux, process details (runtime path, working directory, project root) are cached per PID, so an idle re-scan spawns a single `lsof`. 2. **Classify runtime** from the executable name (`node`, `bun`, `deno`, `python`/`uvicorn`/`gunicorn`, `ruby`/`puma`, `php`, `go run`, `java`, `dotnet`, `elixir`, `docker-proxy`, …). 3. **Slug** = the nearest project-root folder name (markers: `package.json`, `.git`, `go.mod`, `pyproject.toml`, `Cargo.toml`, `mix.exs`, …). 4. **Resolve duplicates** — within one project folder the process on the **lowest port** is the main service (clean, port-free slug); any other process in the same folder gets a `-` suffix so it stays reachable. A single process on several ports collapses to its lowest port. Distinct projects sharing a folder name also get a `-` suffix to stay unique. ## Routing ```mermaid flowchart TD R["Request /seg/rest?query"] --> M{"first segment
matches a slug?
(- / _ interchangeable)"} M -->|yes| H["strip segment · Host → localhost:port
set dcp_route cookie"] M -->|"no (prefix-less asset/HMR)"| CK{"dcp_route
cookie set?"} CK -->|yes| FF["forward full path to the cookie's backend"] CK -->|no| NF["404 + list of services"] H --> UP{"backend up?"} FF --> UP UP -->|yes| OK["stream response
(SSE · WebSocket)"] UP -->|no| E502["502"] ``` For `//?`: - **Hit** → forward to `http://127.0.0.1:/` (segment stripped, `Host` rewritten to `localhost`). Streaming flushes immediately; WebSocket upgrades are relayed. - **Miss / empty** → `404` listing the registered services. - **Dead backend** → `502`. Slugs are canonically dash-separated. With `--match-separators` (on by default), an exact miss is retried with `_` folded to `-`, so `/module_api_foo/` and `/module-api-foo/` reach the same server. `--match-separators=false` routes only the exact dash form. ### Cookie route-affinity Apps assume they live at the root, so their HTML references absolute paths (`/_next/...`, `/api/...`, HMR). When you open `…//`, `dcp` sets a `dcp_route` cookie pinning that browser tab to the project, so prefix-less requests follow it to the right backend — and the page renders exactly like `localhost`. ## Lifecycle ```mermaid sequenceDiagram autonumber participant W as local HTTPS proxy (from boot) participant Px as routing proxy (127.0.0.1:18443) participant Ts as tailscale W->>Px: listen (a new worker waits for the old one to let go) loop every 5 seconds W->>Ts: serve status --json alt dcp's entry missing or in the other mode W->>Ts: funnel | serve --bg 18443 end W->>W: discover every --interval → RouteStore.refresh (debounced) W->>W: online.json: links per provider, or the problem and its fix end Note over W,Ts: dcp tailscale off W->>Ts: remove dcp's entry (only if it points at dcp) ``` - Sharing is on by default and lives in the local HTTPS proxy, so it starts at boot, survives worker swaps (the entry stays; the next worker carries on) and comes back after a Tailscale restart within seconds. - A `RouteStore` is refreshed on a ticker. A service missing from discovery is kept for `deregisterCycles` scans before removal (no flapping on restarts). - Without the boot service, `dcp start` runs the same pieces in a terminal; on `Ctrl-C` the server drains and `tailscale serve|funnel reset` runs before exit — never leaving a Funnel pointing at a dead port. - A single bounded `http.Transport` keeps connections to dev servers from accumulating. ## Online: Cloudflare ```mermaid flowchart LR C["Caller
internet"] C -->|"https://web-bigfoot.example.com/foo"| CF["Cloudflare edge
TLS · proxied CNAME"] CF -->|"tunnel dcp-bigfoot"| CD subgraph machine["your machine"] direction TB CD["cloudflared
connector"] R["dcp host router
127.0.0.1:18444"] D1["127.0.0.1:4983
web · bun"] CD -->|plain HTTP| R R -->|"hostname → app
Host → localhost:4983"| D1 end ``` With `cloudflare` on, the local HTTPS proxy keeps three things in place, next to the Tailscale entry: - **A tunnel** named `dcp-`, managed from Cloudflare's side. Its one ingress rule sends everything to dcp's host router on `127.0.0.1:`, which picks the app by hostname and presents the request as a local one, path unchanged. - **One proxied CNAME per app**, `-.` → `.cfargotunnel.com`, with the comment `dcp `. dcp deletes only records that point at its own tunnel and refuses a hostname that already has a record it did not make. - **The connector**, `cloudflared`, started with the tunnel's token in its environment and restarted when it exits. The tunnel, its ingress and DNS are checked every 5 minutes and whenever the set of apps changes; the tunnel's health every 30 seconds. Turning Cloudflare off stops the connector and keeps the tunnel and DNS, so it comes back fast; `dcp cloudflare off --purge` deletes them. Setup and the token: [Cloudflare](/share#cloudflare). # Troubleshooting One command checks everything and prints the fix for each problem it finds: ```bash dcp doctor # Tailscale, Funnel, discovery and each sharing provider; the boot service, the proxy and the trusted CA dcp status # each provider online, or the problem, its fix and a help link ``` Find your symptom below; the rest of the page has the details. ## Local HTTPS names (`*.localhost`) | Symptom | Fix | | --- | --- | | `dcp run` warns "the local HTTPS proxy is not running" | `dcp service install` (it prints the proxy's log when it cannot start) | | Browser: "not private"; curl: certificate error | `dcp trust` (macOS: at the screen, not over SSH), then restart the browser | | `https://.localhost` can't be reached (no answer, a TLS error) | nothing serves that name: start the app, or check its name with `dcp ls`; a server gets its folder's name unless its config says otherwise ([Pick the name](/local-https#pick-the-name)). `dcp configure --catch-all` makes such names show a page listing what runs | | `https://.localhost` answers 404 "nothing runs at" | the catch-all is on and nothing serves that name: the page lists what does run | | A server runs but has no name | it listens outside the port range (`dcp configure --ports …`), its runtime isn't a web one (`--all`), discovery is off, or its config was skipped: `dcp ls` and `https://dcp.localhost` say which file and how to fix it | | It answers 502 "not answering" | the app is still starting, stopped, or (with `dcp run`) doesn't listen on `$PORT` and `$HOST`; the page shows the port, process and folder | | `http://.localhost` doesn't redirect | another program holds port 80 (`dcp doctor` names it), or the boot service predates the redirect: `dcp service install` once | | "already runs (pid …)" | stop the other terminal's run, or `dcp run --force` | | A port is taken by a server you forgot | `dcp stop ` (or the Stop button on `https://dcp.localhost`); `--force` when it ignores the stop | | Something was slow or failed earlier | `dcp stats` (per name, p50/p95/p99) and `dcp logs` ([Logs and stats](/logs-and-stats)) | | Every `*.localhost` hangs | another program holds port 443: `lsof -nP -iTCP:443 -sTCP:LISTEN` ([Funnel next to the proxy](#funnel-on-443-next-to-dcp-proxy-macos)) | ## Online links (`*.ts.net`, Cloudflare) | Symptom | Fix | | --- | --- | | A provider is not online | `dcp status` prints the problem and its fix: [When a link does not open](/share#when-a-link-does-not-open) | | A link does not open from outside | `dcp check`: DNS, certificate and answer of every link, and the step that failed | | `dcp ls` shows no online links | [No services found](#no-services-found) | | A webhook or callback never arrives | it needs a public link (Funnel or Cloudflare), not tailnet-only: [Webhooks](/webhooks#when-the-provider-cant-reach-it) | | The page loads without styles | open it through its `//` link: [A page loads without styles](#a-page-loads-without-styles) | | Opens on the phone, not on this Mac | [MagicDNS](#works-from-my-phone-but-not-my-mac-magicdns) | | A container can't resolve the `ts.net` name | [Reaching services from a container](#reaching-services-from-a-container-failed-to-resolve-tsnet) | | 502 upstream error | [502](#502-upstream-error): the dev server stopped; it clears on the next scan | | The link stays up after `kill -9` | [Funnel still on after a hard kill](#funnel-still-on-after-a-hard-kill) | ## Works from my phone but not my Mac (MagicDNS) From the host, MagicDNS resolves `.ts.net` to your **tailnet IP**, so the request may be answered locally instead of traversing the public Funnel. - **Test from outside your tailnet** — a phone on cellular, or another network. - **Force the public ingress** from the host: ```bash PUBIP=$(dig +short .ts.net @1.1.1.1 | head -1) curl -s -i --resolve ".ts.net:443:$PUBIP" "https://.ts.net//" ``` ## A page loads without styles Fixed by cookie route-affinity: visiting `…//` sets a `dcp_route` cookie so that tab's prefix-less requests (`/_next/...`, `/api/...`, HMR) reach the right backend. - Make sure you opened it via its **`//`** URL (that's what sets the cookie). - Don't actively use two different apps in the **same browser** at once — affinity is per-browser. Use separate browser profiles, or re-visit the `//` URL. ## Reaching services from a container ("Failed to resolve …ts.net") This error means the container's DNS can't resolve the name. The fix depends on **where the container runs** and **which mode you used** — `*.ts.net` resolves two different ways: - **Funnel (public, default)** — the name is in **public DNS**; any host resolves it. - **Serve (`dcp tailscale on --tailnet`)** — the name only resolves via **MagicDNS inside your tailnet**, pointing at a `100.x` address only tailnet members can route. ### Container on the same machine as `dcp` (Docker Desktop) Skip DNS — talk to the proxy directly by path. Bind it to a reachable address: ```bash dcp --bind 0.0.0.0 ``` ```bash # inside the container — routes // to your local dev server: curl http://host.docker.internal:18443// # Docker Desktop # Linux: docker run --add-host=host.docker.internal:host-gateway ... ``` `container → host dcp → 127.0.0.1:`, no DNS or tailnet involved. `0.0.0.0` exposes the proxy to your LAN — bind a specific interface (e.g. the docker bridge `--bind 172.17.0.1`) to narrow it. `host.docker.internal` only points at the **same host**, so this does **not** work for a remote pod. ### Container on a remote host / Kubernetes (the usual cause) A remote pod can't reach `host.docker.internal`, so use the exposure URL — but how you make it resolve depends on the mode. **Funnel (public, default):** the name is in public DNS, so a pod with working internet DNS should already resolve it. If the pod's resolver is locked down, pin the name to the public Funnel ingress IP (`hostAliases` is the k8s `--add-host`): ```bash dig +short your-node.ts.net @1.1.1.1 # → public ingress IP, e.g. 209.177.145.192 ``` ```yaml # Kubernetes pod spec spec: hostAliases: - ip: "209.177.145.192" hostnames: ["your-node.ts.net"] ``` ```bash # plain Docker on a remote host docker run --add-host "your-node.ts.net:209.177.145.192" ... ``` #### When the remote host is itself on the tailnet (MagicDNS shadows the name) The subtle case. If the consuming host runs Tailscale with MagicDNS enabled (the default, `--accept-dns=true`), Tailscale's resolver `100.100.100.100` answers `*.ts.net` with the node's **tailnet `100.x` address** — not the public Funnel ingress. Traffic then crosses the tailnet to your node's `tailscaled`, which only serves that path if you set up **Serve**; a **Funnel-only** node won't answer. Containers on that host fall back to public DNS, which may still be negatively cached as `NXDOMAIN`: ```bash nslookup your-node.ts.net 8.8.8.8 # NXDOMAIN (not cached yet) nslookup your-node.ts.net 100.100.100.100 # resolves via MagicDNS ``` `dcp doctor` prints an advisory `magicdns` note whenever the node has `accept-dns` on, as a reminder of this gotcha. The Funnel name **is** in public DNS, so stop MagicDNS from shadowing it on the **consuming host** (the remote one — not the machine running `dcp`): ```bash tailscale set --accept-dns=false # use public DNS for *.ts.net; re-enable with =true dig +short your-node.ts.net @8.8.8.8 # now confirms → 209.177.145.192 ``` Prefer `dcp` to do it on start (opt-in, off by default)? Pass `dcp --accept-dns=false`. It persists after exit — revert with `tailscale set --accept-dns=true`. Don't want to change the host's DNS? Fix only the container — point it at MagicDNS, or pin the public IP: ```bash docker run --dns 100.100.100.100 ... # resolve like the host docker run --add-host your-node.ts.net:209.177.145.192 ... # or skip DNS entirely ``` **Why `dcp` doesn't set `--accept-dns=false` for you:** it's a global, persistent, machine-wide Tailscale setting that disables MagicDNS for *every* `*.ts.net` name (breaking resolution for your other tailnet nodes), and it belongs on the **consumer** host — usually a different machine from the one running `dcp`. A dev proxy silently changing your system DNS would be surprising and out of scope, so it's a deliberate, reversible step you run yourself. **Serve (`--tailnet`):** the name and its `100.x` address only work from inside the tailnet — there's no public IP to point at. The remote pod must **join the tailnet**: run a Tailscale sidecar (or the [Tailscale Kubernetes operator](https://tailscale.com/kb/1185/kubernetes)). Once it's on the tailnet, MagicDNS resolves the name and `100.x` routes normally. If the pod can already route `100.x`, map the name to the tailnet IP instead (`tailscale ip -4`): ```bash docker run --add-host "your-node.ts.net:100.x.y.z" ... ``` Rule of thumb: remote container that stays **off** the tailnet → use **Funnel** and resolve the public name. Remote container you can put **on** the tailnet → use **Serve** with a Tailscale sidecar and let MagicDNS do its job. ## No services found `dcp` only registers known web runtimes within the port range by default. ```bash dcp --ports 3000-9000 # widen the range (single port: --ports 4000) dcp --runtimes node,bun,python # add runtimes dcp --all # every listener, incl. unrecognized binaries ``` ## The same project shows on multiple ports / a slug has a `-` suffix Expected. Within one project folder, `dcp` keeps the process on the **lowest port** as the "main" service (clean slug) and gives any *other* process in the same folder a `-` suffix so it stays reachable — e.g. `bun dev` on `:3087` → `myapp/`, an aux tool on `:4983` → `myapp-4983/`. A single process on several ports is collapsed to its lowest port. Two **distinct** projects sharing a folder name also get a `-` suffix. Run `dcp ls` for the canonical slugs. ## `lsof` not found (macOS/Linux) Install it: `apt install lsof` / `dnf install lsof`. macOS ships it. ## Funnel still on after a hard kill A terminal `dcp start` resets on `Ctrl-C`. After `kill -9`, clear it manually: ```bash tailscale funnel reset # or: tailscale serve reset (for Serve) tailscale serve status # should print "No serve config" ``` The local HTTPS proxy's share is meant to stay on; `dcp tailscale off` removes its entry. ## `502` upstream error The registered dev server isn't accepting connections (crashed or exited between scans). The body names the failed `127.0.0.1:`; it clears on the next scan once the server is back. `dcp start --bg` runs detached and logs to `./dcp.log`. Stop it by `kill`-ing the printed pid, then `tailscale serve status` to be sure the entry is down. ## Funnel on 443 next to `dcp proxy` (macOS) Tailscale.app's Serve/Funnel on `443` listens on every address (`*:443`); `dcp proxy` listens on `127.0.0.1:443` and `[::1]:443`. macOS hands local connections to the more specific listener, so both run side by side in either start order (`dcp proxy` binds as root, before it drops to your user): `https://*.localhost` goes to `dcp proxy`, the public `https://.ts.net//` to the Funnel. Another local HTTPS proxy that listens on `*:443` itself cannot share the port. If every `https://*.localhost` hangs while dcp runs, `lsof -nP -iTCP:443 -sTCP:LISTEN` shows who holds it; move the Funnel off 443 with: ```bash dcp tailscale on --https-port 8443 # dcp's entry moves to 8443 ``` The local proxy port (`port`, default `18443`) must never be the public port: dcp refuses a `port` equal to `httpsPort`.