Skip to content

Local hostnames

For local development you do not need public DNS or certificates. The all-in-one compose stack includes a small DNS sidecar, worker-dns, and a helper script that points your operating system at it.

  • worker-dns is a zone-scoped CoreDNS container listening on 127.0.0.1:15353 (UDP and TCP). Change the port with WORKERS_DNS_PORT.
  • It answers *.<zone> with 127.0.0.1. The zone is WORKERS_DOMAIN, default workers.local. It is not a general resolver.
  • Worker traffic enters the stack on 127.0.0.1:8080 (VRT_PORT). The console is on 127.0.0.1:8788 and the plane on 127.0.0.1:8787.
  • Do not use port 5353; macOS mDNSResponder owns it and the script refuses it.

Start the stack first, then run from the repository root:

Terminal window
node scripts/all-in-one-local-dns.mjs --domain workers.local --port 15353

The script reads its defaults from the WORKERS_DOMAIN and WORKERS_DNS_PORT environment variables, not from .env, so pass the flags explicitly if you changed them. The domain must contain a dot and match ^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$. The port must be 1 to 65535.

OS What the script does
macOS With sudo, writes /etc/resolver/<domain> containing nameserver 127.0.0.1 and port <port>, then self-verifies with dscacheutil.
Linux Prints a systemd-resolved drop-in (/etc/systemd/resolved.conf.d/workers-local.conf with DNS=127.0.0.1:<port> and Domains=~<domain>) and the command sudo systemctl restart systemd-resolved.
Other Prints a manual instruction.
Terminal window
dscacheutil -q host -a name probe.workers.local # macOS, expect 127.0.0.1
dig @127.0.0.1 -p 15353 probe.workers.local +short # any OS, expect 127.0.0.1

Then open a worker at http://<worker>.workers.local:8080/. Without the resolver you can still reach it by sending the Host header:

Terminal window
curl -H 'Host: hello.workers.local' http://127.0.0.1:8080/
  1. Set WORKERS_DOMAIN, WORKERS_DNS_PORT and VRT_PORT in .env.
  2. Recreate the stack: docker compose -f docker-compose.all-in-one.yml up -d.
  3. Re-run the script, for example node scripts/all-in-one-local-dns.mjs --domain workers.test --port 15353.

WORKERS_DOMAIN also becomes the default worker domain, so new workers are named <name>.<WORKERS_DOMAIN>. Existing hostnames are not rewritten.

On macOS:

Terminal window
sudo rm /etc/resolver/workers.local
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

On Linux, remove the drop-in and restart systemd-resolved.

  • Local hostnames are plain HTTP on VRT_PORT; there is no TLS.
  • In TLS installs the installer sets WORKERS_DOMAIN to your worker base domain, so do not mix this guide with a public install.
  • Use .test or workers.local-style names that you do not own publicly.

See also Services and ports and Configuration.