Skip to content

Instantly share code, notes, and snippets.

@christophemarois
Created March 23, 2023 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christophemarois/66bae532891a6695e3e447d170a011c9 to your computer and use it in GitHub Desktop.
Save christophemarois/66bae532891a6695e3e447d170a011c9 to your computer and use it in GitHub Desktop.
Run a local HTTPS server

Use Caddy (brew install caddy) to run localhost sites with custom addresses and https certificates.

  1. Run caddy reverse-proxy --from site.localhost --to localhost:3000
  2. Visit https://site.localhost/

For a more stable config, create a Caddyfile

site.localhost {
  reverse_proxy localhost:3000
}
api.localhost {
  reverse_proxy localhost:3001
}

And start it in the background with caddy start or in the foreground with caddy run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment