unContainer

Guides

Serve each worktree over HTTPS

Give every worktree’s dev server a stable https:// URL under uncontainer.localhost, with hot reload, trusted only by your own account.

You’ll need the unContainer CLI v0.4.0 or later and mkcert on the host. Your app runs inside the guest, so its runtime (for example Node and Vite) must be available there for Linux ARM64.

1. Enable HTTPS for your account

Run this once per account. It checks for mkcert, explains the trust change and asks for confirmation.

uncontainer https enable
  • macOS. Install mkcert with brew install mkcert. Approve the macOS dialog with your account password. A user LaunchAgent then owns the IPv4 and IPv6 loopback sockets on port 443.
  • Linux. Install mkcert and the NSS certutil tool (Debian package libnss3-tools). Open your browser profile at least once before enabling. The CLI installs the root in the account’s Chromium NSS databases and in existing Firefox profiles under ~/.mozilla/firefox and ~/.config/mozilla/firefox. Restart the browser afterwards.

2. On Linux, start the proxy

macOS needs nothing here. On Linux, keep the listener running in another terminal. It uses port 8443 unless you pick another free loopback port.

uncontainer https proxy uncontainer https proxy --port 9443

3. Start each worktree’s app

From each worktree, start an ordinary HTTP server and name it with --https NAME:GUEST_PORT:

cd ../checkout uncontainer run --https checkout:5173 -- ./node_modules/.bin/vite --port 5173 --strictPort
cd ../catalog uncontainer run --https catalog:5173 -- ./node_modules/.bin/vite --port 5173 --strictPort
  • Names use lowercase letters, digits and hyphens, up to 63 characters.
  • Omit the name (--https 5173) to get a stable short name derived from the worktree path.
  • A name belongs to the worktree that registered it. Using it from another worktree fails.
  • --https works with run, once per command.

4. Open the URLs

The CLI prints each URL, such as https://checkout.uncontainer.localhost/ on macOS or https://catalog.uncontainer.localhost:8443/ on Linux.

The proxy speaks HTTP/2, HTTP/1.1 and WebSockets. Vite works with its default HMR client settings. Edits to regular source files in the host worktree are copied into the guest as you save, so the app’s file watcher sees them. Live updates skip symlinks, Git metadata, node_modules and .vite.

5. Restart without changing the URL

If the app exits, its URL answers 503. Run it again from the same worktree with the same name. It can listen on a different guest port and keep the same URL:

uncontainer run --https checkout:5199 -- ./node_modules/.bin/vite --port 5199 --strictPort

Before forwarding bytes, the proxy checks each upstream connection against the registered command’s guest PID namespace. Processes the command starts belong to that instance. Other worktrees keep their own registrations and guests.

6. Remove trust

uncontainer https disable

Stops the listener, deletes the HTTPS keys and removes browser trust. macOS may ask for your account password again. Until then, the account’s private CA lives under ~/.local/share/uncontainer/https (or $XDG_DATA_HOME/uncontainer/https). Keep its key private.