Skip to content

feat: add --https flag for auto-generated self-signed certificates#841

Open
hemanth wants to merge 1 commit intovercel:mainfrom
hemanth:feat/auto-https
Open

feat: add --https flag for auto-generated self-signed certificates#841
hemanth wants to merge 1 commit intovercel:mainfrom
hemanth:feat/auto-https

Conversation

@hemanth
Copy link
Copy Markdown

@hemanth hemanth commented Feb 19, 2026

What

Adds a --https flag that auto-generates a self-signed TLS certificate at startup, so you can serve over HTTPS without providing your own certs.

serve --https
# INFO  Auto-generated self-signed certificate for HTTPS.
# Serving!
# - Local:    https://localhost:3000
# - Network:  https://192.168.1.216:3000

Why

Testing service workers, WebAuthn, Secure Contexts, and other HTTPS-only browser APIs locally shouldn't require mkcert or OpenSSL. One flag, zero setup.

How

  • New source/utilities/tls.ts — generates a self-signed X.509 v3 certificate using Node's built-in crypto module (no new dependencies)
  • Certificate is valid for localhost, 127.0.0.1, and ::1 (1-year validity, 2048-bit RSA)
  • Wired into the existing https.createServer() path in server.ts
  • Explicit --ssl-cert/--ssl-key takes priority over --https
  • Regular HTTP behavior unchanged

Files changed

File Change
source/utilities/tls.ts NEW — self-signed cert generator
source/types.ts Added --https to Options
source/utilities/cli.ts Help text + arg parser
source/utilities/server.ts Auto-cert wiring

Testing

  • serve --https → serves on https://localhost:3000
  • curl -k https://localhost:3000 → HTTP 200
  • serve (without flag) → HTTP unchanged

@hemanth
Copy link
Copy Markdown
Author

hemanth commented Feb 22, 2026

//cc @rauchg @timneutkens @arunoda

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant