Skip to content
Live demo →

API to API (unicomm proxy)

In v0.1.2 one command, unicomm proxy, covers both directions: a port or http://host:port wraps a local service in PQ TLS, an https:// URL gives a plain local app access to a PQ API.

Terminal window
unicomm proxy 8080 --policy pq-required # wrap local port 8080 in PQ TLS (listens on 0.0.0.0:8443)
unicomm proxy https://api.example:8446 --listen 127.0.0.1:9000 # a plain local port that reaches a PQ API

A number or http://host:port target wraps a local service (the serve flags below). An https:// target connects to a remote API (the connect flags below). For raw TCP add --tcp; add --connect to treat the target as the remote.

Two small proxies cover the common case where you cannot touch the application code:

  • unicomm proxy <port> (alias serve) is a TLS-terminating reverse proxy. It listens with a UniComm policy and forwards to a plain-HTTP upstream (or, with --tcp, any TCP service).
  • unicomm proxy https://... (alias connect) is the other end: a local plain-HTTP listener that reaches a remote HTTPS API over the chosen policy (or, with --tcp, TLS-wraps a raw stream).
legacy client --http--> unicomm proxy https://.. ==PQ TLS==> unicomm proxy 8080 --http--> legacy API
(loopback) 127.0.0.1:9000 0.0.0.0:8443 127.0.0.1:8080
Terminal window
unicomm proxy http://127.0.0.1:8080 --listen 0.0.0.0:8443 --policy pq-required \
--cert fullchain.pem --key key.pem
Flag Meaning
target (required) a port, or plain upstream http://127.0.0.1:8080; with --tcp a host:port (alias serve takes it as --upstream)
--listen TLS listen address, default 0.0.0.0:8443
--policy hybrid (default), pq-required, cnsa2
--cert / --key certificate chain and key; without them the local dev PKI in --cert-dir (default certs)
--client-ca mTLS: require a client certificate signed by a CA in this PEM file
--http3 also listen for HTTP/3 on the same port number over UDP (not with --tcp or cnsa2)
--tcp TLS-terminate a raw TCP service instead of HTTP
--metrics-path serve Prometheus counters at this path, for example /_unicomm/metrics

Reach a remote API (proxy https://..., alias connect)

Section titled “Reach a remote API (proxy https://..., alias connect)”
Terminal window
unicomm proxy https://api.example:8446 --listen 127.0.0.1:9000 --policy pq-required --cacert ca.pem
curl http://127.0.0.1:9000/health # your legacy client talks plain HTTP to the local proxy

Flags: --listen (default 127.0.0.1:9000), the target (--to for the connect alias), --policy (hybrid default, also pq-required, cnsa2, classical), --cacert (trust only this CA), --cert / --key (mTLS client identity), --server-name, --tcp.

  • The leg between the proxy and the plain side is not encrypted. Keep it on loopback or a private network.
  • The proxy opens a new connection to the plain side for every request (no pooling).
  • HTTP/1.1 and HTTP/2, WebSocket upgrade passthrough and streaming bodies are handled; the tests for them were not part of this docs work.
  • This conflicts with ADR-0010 (no plaintext hop) unless the plain leg stays on one host. That is a known gap, listed under Security and limits.