@o-town/dev-https
v2.1.0
Published
Zero-config HTTP → HTTPS proxy for any npm run dev server
Downloads
153
Maintainers
Readme
dev-https
Zero-config HTTP → HTTPS proxy for any
npm run devserver.
Generates a self-signed certificate on the fly — no OpenSSL, no config files.
Install
# as a dev dependency (recommended)
npm install --save-dev dev-https
# or globally
npm install -g dev-httpsUsage
Wrap your dev command directly
# Vite (default port 5173)
npx dev-https -p 5173 npm run dev
# Create React App (port 3000)
npx dev-https -p 3000 npm run dev
# Next.js
npx dev-https -p 3000 npm run dev
# Webpack / Angular / any other server
npx dev-https -p 4200 npm startAdd a script to package.json
{
"scripts": {
"dev": "vite",
"dev:https": "dev-https -p 5173 npm run dev"
}
}npm run dev:httpsProxy-only (dev server already running)
npx dev-https -p 3000 # wraps http://localhost:3000Options
| Flag | Default | Description |
|---|---|---|
| -p, --port <n> | 3000 | HTTP port your dev server listens on |
| --https-port <n> | 3443 | HTTPS port the proxy will open |
| -h, --help | — | Show help |
How it works
Browser
│ https://localhost:3443 (self-signed TLS)
▼
┌──────────────┐ ┌───────────────────────┐
│ dev-https │ HTTP/WS │ Your dev server │
│ proxy :3443 │ ───────► │ http://localhost:PORT │
└──────────────┘ └───────────────────────┘- Self-signed cert — generated in memory on every run, nothing written to disk.
- WebSocket passthrough — Vite/webpack HMR keeps working.
- HTTP → HTTPS redirect — attempted on port 80 (skipped silently if not available).
First visit: your browser will show a certificate warning.
Click Advanced → Proceed to localhost to continue.
Programmatic API
const { createDevHttps } = require("dev-https");
const { close } = createDevHttps({
targetPort: 5173,
httpsPort: 3443,
onReady({ httpsPort, targetPort }) {
console.log(`https://localhost:${httpsPort} → http://localhost:${targetPort}`);
},
});
// stop later
close();Frameworks at a glance
| Framework | Default port | Script |
|---|---|---|
| Vite | 5173 | dev-https -p 5173 npm run dev |
| Create React App | 3000 | dev-https -p 3000 npm run dev |
| Next.js | 3000 | dev-https -p 3000 npm run dev |
| Angular CLI | 4200 | dev-https -p 4200 npm start |
| Nuxt | 3000 | dev-https -p 3000 npm run dev |
| SvelteKit | 5173 | dev-https -p 5173 npm run dev |
License
MIT
