Run any local app with HTTPS and a custom domain.
- Certificates via mkcert
- Hosts mapping in
/etc/hosts
- HTTPS reverse proxy using WEBrick with SNI support
- Optional HTTP → HTTPS redirect on port 80
Homebrew (Tap):
brew tap vikas-0/tap
brew install vikas-0/tap/local-https
Manual (from source):
./install.sh
The proxy binds to port 443, which typically requires root privileges. You'll likely run proxy commands with sudo
.
# Add a mapping and generate a cert
local-https add myapp.test 3000
# Start the HTTPS reverse proxy (binds to :443, also starts :80 redirect)
sudo local-https start
# Start in foreground for debugging (shows logs)
sudo local-https start --no-daemon
# Disable HTTP→HTTPS redirect (only serve HTTPS on :443)
sudo local-https start --no-redirect-http
# Visit your app
open https://myapp.test
open http://myapp.test # will redirect to https (if redirect is enabled)
# List mappings
local-https list
# Remove mapping (also stops proxy)
local-https remove myapp.test
# Stop proxy
sudo local-https stop
- Certs are stored in
~/.local-https/certs
as<domain>.pem
and<domain>-key.pem
. - Config is
~/.local-https/config.json
. /etc/hosts
is updated with127.0.0.1 <domain> # local-https
(requires sudo).- The proxy uses SNI to present the right certificate per requested domain and forwards to
http://127.0.0.1:<port>
based on theHost
header. - If enabled, an HTTP server on port 80 issues a
301
to the equivalenthttps://<host><path>
URL.- If port 80 is unavailable, the proxy continues without HTTP redirect and logs a warning.
- If binding to
:443
fails: run withsudo
. - If binding to
:80
fails: another service is using it. Either free it or runsudo local-https start --no-redirect-http
. - If
mkcert
is missing: run./install.sh
or install manually. - If
/etc/hosts
updates fail: run commands that touch hosts withsudo
. - When running with
sudo
, the tool stores config and certs under the invoking user's home (viaSUDO_USER
), not/var/root
. - Foreground mode (
--no-daemon
) is helpful to see startup errors.
# Run from source (no install required)
bin/local-https list
sudo bin/local-https start --no-daemon
# Or build and install the gem locally
gem build local-https.gemspec
sudo gem install ./local-https-*.gem