Skip to content

feat(dev-server): support ssl, sslKey, sslCert for HTTPS dev (#142) - #184

Merged
lukekania merged 1 commit into
milestone/v0.11.0-builder-parityfrom
feat/dev-server-ssl
Jun 8, 2026
Merged

feat(dev-server): support ssl, sslKey, sslCert for HTTPS dev (#142)#184
lukekania merged 1 commit into
milestone/v0.11.0-builder-parityfrom
feat/dev-server-ssl

Conversation

@lukekania

Copy link
Copy Markdown
Owner

Closes #142.

Honors the ssl/sslKey/sslCert dev-server options so projects needing HTTPS in dev (OAuth callbacks, secure-cookie testing, mixed-content debugging, service-worker registration) can use ngc-rs without a separate TLS-terminating proxy. Previously the builder hard-failed on any SSL config.

Changes

  • crates/dev-server — new TlsConfig: from_pem for explicit cert/key material, self_signed (via rcgen) for the auto-generated case, covering the bind host plus the loopback names (localhost, 127.0.0.1, ::1). DevServerConfig::with_tls feeds the PEM into tiny_http's ssl-rustls backend, and the SSE live-reload stream rides the same TLS connection. DevServer::scheme() reports https/http. The private key is redacted from Debug.
  • crates/cli--ssl, --ssl-key, --ssl-cert on serve. resolve_tls enforces both-or-neither cert paths and that key/cert require --ssl; the printed URL uses the correct scheme.
  • packages/builderoptions.ts forwards the flags, resolves cert paths against the workspace root, emits an https:// URL, and rejects ssl + proxyConfig. Schema descriptions updated; README serve section corrected.

ssl: true without explicit key/cert mints a throwaway self-signed certificate (matching @angular/build:dev-server); browsers show the usual untrusted-certificate warning.

Out of scope

ssl combined with proxyConfig is rejected with an actionable error — the proxy is the browser-facing endpoint, so HTTPS would need Node-side TLS termination + cert coordination. Tracked as a follow-up.

Verification

  • Unit tests for TlsConfig, resolve_tls, and buildSslArgs.
  • TLS integration tests: HTTPS GET with injected live-reload client, SSE-over-TLS reload event, explicit-cert round-trip (rustls client that skips verification).
  • cargo clippy -D warnings clean; changed files pass fmt --check; builder lint + 78 TS tests green.
  • End-to-end: ngc-rs serve --ssl against a real project boots https://…; curl -k returns 200 over a TLS 1.3 handshake with the rcgen self-signed cert (verify code 18 = self-signed).

Version bumped to 0.10.16.

The dev-server builder hard-failed whenever ssl/sslKey/sslCert was set, so
projects needing HTTPS in dev (OAuth callbacks, secure-cookie testing,
mixed-content debugging, service-worker registration) had to stand up a
separate TLS-terminating proxy. ngc-rs now serves HTTPS directly.

- dev-server: new TlsConfig (from_pem for explicit material, self_signed via
  rcgen for the auto-generated case, covering the bind host plus the loopback
  names). DevServerConfig::with_tls wires the PEM into tiny_http's ssl-rustls
  backend; the SSE live-reload stream rides the same TLS connection.
  DevServer::scheme() reports https/http. The private key is redacted from
  Debug output.
- cli: --ssl/--ssl-key/--ssl-cert on serve. resolve_tls enforces both-or-
  neither cert paths and that key/cert require --ssl; the printed URL uses the
  right scheme.
- builder: options.ts forwards the flags, resolves cert paths against the
  workspace root, emits an https:// URL, and rejects ssl + proxyConfig (the
  proxy is the browser-facing endpoint; Node-side TLS termination is out of
  scope). Schema descriptions updated; README serve section corrected.

ssl: true without explicit key/cert mints a throwaway self-signed certificate,
matching @angular/build:dev-server; browsers show the usual untrusted-cert
warning.

Bump version to 0.10.16.
@lukekania
lukekania merged commit 92afdd1 into milestone/v0.11.0-builder-parity Jun 8, 2026
6 checks passed
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