# @devfn/proxy Maintains one lock-protected, DevFn-owned Caddy route registry. - **Routes.** Generated configurations contain concrete `.localhost` or explicitly registered local-domain routes and loopback targets only, are validated before reload, and deny unknown HTTP hosts. Selected TLS hosts redirect HTTP to HTTPS; unknown hosts receive 404. If another Caddy owns the admin endpoint, DevFn refuses to replace its configuration. DevFn runs the Caddy found in an absolute `PATH` directory, never one found through a relative entry, and uses that one binary to validate, reload and run a configuration. - **Listeners and ports.** Caddy binds to 127.0.0.1 and adds ::1 when the host supports it; DNS answers for any other address, including another 127/8 address, are rejected because Caddy does not bind them. macOS uses unprivileged loopback ports 8080 and 8443, so its published URLs include those nonstandard ports; Linux uses 80 and 443, so its URLs omit the port. Existing v0.1 services on these ports must be stopped and assigned another exact or preferred port before activating a proxy route. A conflict identifies the owning instance and service; DevFn does not reassign or stop it. - **Linux privileges.** Linux requires permission to bind the privileged ports: either `net.ipv4.ip_unprivileged_port_start` at or below 80, or `cap_net_bind_service` granted to the Caddy binary with `setcap`. DevFn changes neither. A capability-bearing Caddy is non-dumpable, so same-user socket inspection cannot attribute its sockets; DevFn then accepts its recorded owner only when the PID start identity matches and the live admin configuration equals DevFn's committed configuration. - **Activation and readiness.** A started Caddy counts as activated only after it confirms through `--pingback` that its whole configuration, including every HTTP and HTTPS listener, started; an answering admin endpoint alone is not enough. A failed bind therefore fails activation before a ready replacement is stopped. Instance readiness also requires the committed routes to equal the receipt's routes and the recorded Caddy owner to be alive, to run the configuration rendered from the committed (or journaled pending) route state as shown by its live admin configuration, and to accept connections on its listener ports. - **TLS and DNS.** It never installs its internal CA in a trust store. Registered domains are bound to a repository and project in machine state. New or changed registered routes must resolve exclusively to available Caddy loopback binds, and explicit certificates must cover every route hostname through a DNS SAN. DNS verification fails closed after five seconds, so a stalled lookup cannot indefinitely hold the shared proxy lock. - **Snapshots and rollback.** Activated explicit certificates are kept as private immutable snapshots so sibling cleanup can reload after a source file disappears. Stopping one instance can retain another instance's established routes when its DNS is temporarily unavailable. A pending activation with invalid DNS or certificate is rolled back to the last committed routes. A failed or timed-out reload does not prove Caddy kept its previous routes: the activation's journal stays, marked uncertain (`proxy-routes.pending.uncertain`), and its routes count as possibly live until a reload of the committed routes succeeds. That reload is tried at once and by the next routing command or route preflight, which rolls the activation back rather than replaying it. The journal is marked before it is published and reloaded, so this holds even when nothing can be written after the failure, and an interrupted activation is rolled back too; only an unmarked journal, such as one an earlier release left, is replayed. Like every transition and preflight, it leaves out routes of services verified gone, whose IDs and hostnames another owner may then take, and only the routes Caddy confirmed are committed. Until it succeeds, commands that change routes fail rather than treat its routes as gone. Removing or emptying an owner that no route state names changes no routes, so it never touches Caddy or another owner's journal.