HeadlinesBriefing favicon HeadlinesBriefing.com

Port Zero: No More Port Conflicts with Local Domains

Hacker News •
×

Developers often waste time wrestling with port numbers, only to discover a backend mismatch. Port Zero solves this by letting the OS assign a random port when you set the listening port to 0, then mapping a stable subdomain to that port.

The GPLv3 tool watches processes or Docker containers that export a special PZ_TUNNEL variable. It creates a virtual NIC, assigns a virtual IP, and generates a DNS record like *myapp‑feat‑checkout.portzero.local*. Connections to that virtual IP on the desired port (e.g., 80 for HTTP) are forwarded to the container’s random OS‑assigned port.

With this system you can run multiple branches or AI agents simultaneously. Each git worktree gets its own self‑explanatory URL, eliminating EADDRINUSE errors and simplifying debugging. The tool also adds a local CA for HTTPS and offers paid cloud tunnels that expose the same app to phones or other devices.

Port Zero is free for local tunnels and open source. Cloud features require a flat‑rate plan, but the core functionality—stable local domains, no port juggling, and instant HTTPS—remains free.