local-run-cli
v0.1.2
Published
Run a public domain locally with Caddy, local TLS, hosts-file updates, and DNS cache flushing on macOS.
Maintainers
Readme
local-run
local-run maps a real domain to your local machine, provisions a local TLS certificate with Caddy, updates /etc/hosts, flushes macOS DNS caches, and runs the proxy in the background.
Warning: macOS only.
local-run currently supports macOS only. It relies on macOS DNS cache commands and local system paths that are not implemented for Linux or Windows.
Install
npm install -g local-run-cliUsage
Start a local proxy for a real domain and forward it to your local app on port 5173:
local-run start --domain jungle4-account.unicove.com --port 5173Stop the active proxy, remove the managed /etc/hosts entry, and flush DNS:
local-run stopWhat it does
local-run start:
- installs Caddy with Homebrew if it is missing
- creates a Caddy config for
https://<domain> - trusts Caddy's local CA
- adds managed IPv4 and IPv6 localhost
/etc/hostsentries - flushes macOS DNS caches
- starts Caddy in the background
- prints browser instructions to force the browser onto the local copy
local-run stop:
- stops the background Caddy process
- removes the managed
/etc/hostsentry - flushes macOS DNS caches
- removes its local state files
Browser notes
Browsers can keep DNS and socket caches even after the system DNS cache has been flushed. If the remote site still loads:
- close existing tabs for the target domain
- open a fresh tab or incognito window
- in Chrome or Edge, open
chrome://net-internals/#dnsand clear the host cache - then open
chrome://net-internals/#socketsand flush socket pools - hard refresh and verify the certificate issuer is Caddy's local authority
Development
npm test
node src/cli.js start --domain jungle4-account.unicove.com --port 5173
node src/cli.js stop