v2.6.0: Proxy auto-start and sudo supervisor fixes
Pitchfork v2.6.0 adds automatic daemon startup when visiting a proxy URL and fixes several issues with port conflict detection and running the supervisor under sudo.
Highlights
- Proxy auto-start: Visiting a proxy URL for a stopped daemon now triggers an automatic start instead of returning a 502 error. The browser shows a "Starting..." page that auto-refreshes until the daemon is ready.
- Reliable port conflict detection: Port availability checks now probe loopback addresses (
127.0.0.1,::1) in addition to0.0.0.0, fixing false negatives on macOS/BSD whereSO_REUSEADDRallowed binding wildcard addresses even when the port was occupied on localhost.
Added
-
Proxy auto-start -- When you visit a proxy URL for a daemon that isn't running, pitchfork now automatically starts it. Instead of a 502 error, the browser shows a "Starting..." page that refreshes every 2 seconds until the daemon is ready, then proxies normally. This is enabled by default and requires no extra configuration beyond the normal proxy setup. The timeout for the entire auto-start operation defaults to 30 seconds and is configurable. (#347) - @gaojunran
[settings.proxy] auto_start = true # default auto_start_timeout = "30s" # default; increase for slow-starting daemons
Fixed
-
Port conflict detection on loopback addresses -- Port availability checks now probe
127.0.0.1and::1in addition to0.0.0.0. On macOS/BSD, Rust'sTcpListener::bindsetsSO_REUSEADDRby default, which allowed binding0.0.0.0:porteven when127.0.0.1:portwas already occupied. This caused pitchfork to report a port as available when it was actually in use, leading to daemons silently falling back to a different port. (#345) - @gaojunran -
ready_portconflict detection -- Whenready_portis configured withoutexpected_port, pitchfork now checks whether the port is already in use before starting the daemon. Previously, if another process was listening on that port, the TCP readiness probe would immediately succeed and pitchfork would falsely consider the daemon ready, routing proxy traffic to the wrong process. (#350) - @gaojunran -
Sudo supervisor issues -- Fixed multiple problems when running the supervisor with
sudo(required for binding to ports 80/443 for the HTTPS proxy). The home directory is now resolved fromSUDO_USERvia the system password database when running as root, ensuring state files, IPC sockets, config paths, and logs remain consistent with non-sudo invocations. IPC socketchownand state directory permission fixes now only trigger when the effective UID is actually 0, preventing staleSUDO_UID/SUDO_GIDenvironment variables from causing issues in non-sudo environments. Process kill operations now properly propagate permission errors with an actionable "Try rerun with sudo" message. (#323) - @gaojunran
Full Changelog: v2.5.0...v2.6.0