https://github.com/zetcco/serve-local
Lightweight zsh script to quickly expose local ports via custom local domains with HTTPS
https://github.com/zetcco/serve-local
bash dns https local-development local-https-servers proxy zsh
Last synced: 29 days ago
JSON representation
Lightweight zsh script to quickly expose local ports via custom local domains with HTTPS
- Host: GitHub
- URL: https://github.com/zetcco/serve-local
- Owner: zetcco
- Created: 2026-05-14T10:17:51.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-18T06:01:36.000Z (about 2 months ago)
- Last Synced: 2026-05-18T08:11:38.307Z (about 2 months ago)
- Topics: bash, dns, https, local-development, local-https-servers, proxy, zsh
- Language: Shell
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# serve-local
A lightweight Zsh script to quickly expose local ports via custom local domains over HTTPS using Caddy. It handles local DNS routing and SSL certificate provisioning automatically, cleaning up entirely when you stop it.
## How it Works
1. It appends a temporary loopback mapping for your custom domain to `/etc/hosts`.
2. It dynamically generates a temporary Caddyfile configured with internal TLS and a reverse proxy to your specified local port.
3. It spins up Caddy using this configuration to serve secure HTTPS traffic locally.
4. Upon script exit or interception of a termination signal (Ctrl+C), it automatically reverts the `/etc/hosts` changes and deletes the temporary configuration file.
Note: If the script was stopped non-gracefully, you will have to manually edit out the changes made to `/etc/hosts`
## Prerequisites
Ensure you have `caddy` installed and available in your PATH.
```bash
brew install caddy
```
## Usage
```bash
chmod +x serve-local
./serve-local
```
### Example
```bash
./serve-local test.bijira.dev 8080
```