Ports & sharing

Run a dev server inside your workspace terminal — e.g. npm run dev on port 3000 — and the workspace header detects it within ~30 seconds. Each detected port (:3000, :5173, ...) gets two links: a share link like /p/<token> and a direct link on its own subdomain like https://<port>--<sessionId>.dg.run/. Click the port number to open the best one available; use the copy (⧉) button to grab the share link.

Share links (work everywhere)

Each port's share link looks like /p/<token>:

  • Send it to anyone — no sign-in, no session id, no port number in the URL. The token is random and unguessable.
  • It stays valid until the session ends. Stopping the session kills all its share links instantly.
  • Traffic goes through dg.run to your workspace, so the app must listen on localhost (the default for npm run dev, Vite, Next.js).
  • Pages render normally, but live-reload / hot-module-replacement over websockets does not survive the trip through a share link — expect full page reloads instead of instant hot updates.

Copy the share link with the ⧉ button next to the port (it turns ✓ when copied).

Direct links (fast, with live-reload)

Each port also gets a direct link on its own subdomain, like https://<port>--<sessionId>.dg.run/, that connects straight to your workspace:

  • Public, like share links — but served directly, so root-absolute URLs and websocket-based HMR work unmodified.
  • No detour, so apps behave exactly as they do on localhost.
  • Clicking the port number opens the best link available: custom address first, then the direct link, then the share link — the tooltip on each port tells you which one you're opening.

A fresh direct link can show as waiting for a few seconds while worldwide DNS picks the new address up — it unlocks by itself, and until then the port opens the share link instead. Opening an address early lands on a retry page that flips over automatically, not an error.

Custom addresses

Want a memorable URL instead of a token or port-prefixed host? Click the ✎ button next to a port. Two options — details in Custom addresses:

  • dg.run name — https://<name>.dg.run/, first come first served, auto-removed when the session ends.
  • Own domain — serve the port on yourdomain.com by pointing its A record at the shown IP.

Good to know

  • Ports are public: anyone with the link can open them. Only share links you mean to share, and never put secrets in a dev server without its own auth.
  • Detection polls while the session is live (~30s interval) — a freshly started dev server can take one poll to appear.
  • Only http(s) dev servers are proxied. Raw TCP, UDP, and non-HTTP protocols don't work through these links.
  • Stopped sessions take all three link types down with them: share links 404, direct and custom addresses stop resolving.