CL-HTTP supports TLS 1.3 and TLS 1.2 for server, client, proxy, and Web walker on both active ports:
CL-HTTP ships with self-signed Ed25519 and RSA-2048 certificates in
http:pw;ssl; for testing. To start an HTTPS server:
(define-https-service :port 8443 :certificate #p"http:pw;ssl;rsa2048-cert.pem" :private-key #p"http:pw;ssl;rsa2048-key.pem" :password :none :ciphers :all :ssl-version :tls-1.2 :enable-service-p t)
(define-https-service :port 8443 :certificate #p"http:pw;ssl;ed25519-cert.pem" :private-key #p"http:pw;ssl;ed25519-key.pem" :password :none :ciphers :all :ssl-version :tls-1.3 :enable-service-p t)
(ensure-https-protocol-on-port 8443 :certificate #p"http:pw;ssl;ed25519-cert.pem" :private-key #p"http:pw;ssl;ed25519-key.pem" :password :none)
Test with:
curl -sk https://localhost:8443/cl-http/cl-http.html | head -3
Ed25519 provides fast handshakes and small key sizes. Supported by pure-tls (SBCL) and OpenSSL 1.1.1+ (LispWorks).
# Generate Ed25519 private key
openssl genpkey -algorithm Ed25519 -out ed25519-key.pem
# Generate self-signed certificate (10 years)
openssl req -new -x509 -key ed25519-key.pem -out ed25519-cert.pem \
-days 3650 -subj "/CN=localhost/O=CL-HTTP/C=US"
RSA-2048 is supported by all TLS libraries and browsers.
# Generate RSA-2048 private key (no passphrase)
openssl genrsa -out rsa2048-key.pem 2048
# Generate self-signed certificate (10 years)
openssl req -new -x509 -key rsa2048-key.pem -out rsa2048-cert.pem \
-days 3650 -subj "/CN=localhost/O=CL-HTTP/C=US"
openssl ecparam -genkey -name prime256v1 -out ecdsa-key.pem
openssl req -new -x509 -key ecdsa-key.pem -out ecdsa-cert.pem \
-days 3650 -subj "/CN=localhost/O=CL-HTTP/C=US"
Copy key and certificate files to http:pw;ssl;:
(translated-pathname "http:pw;ssl;") ⇒ #P"/path/to/cl-http/log/pw/ssl/"
Restrict file permissions on private keys:
chmod 600 *-key.pem
The define-https-service
macro configures and starts an HTTPS listener. Key parameters:
Parameter Description Default :portHTTPS listen port 443 :certificatePathname to PEM certificate (required) :private-keyPathname to PEM private key (required) :passwordKey passphrase, or :none:prompt:ssl-version:tls-1.3,:tls-1.2Implementation default :ciphers:all,:high, or OpenSSL cipher string:all:enable-service-pStart listening immediately nil
URLs must be exported on the HTTPS port to be accessible:
(export-url #u("/cl-http/" :port 8443 :protocol :https)
:directory
:recursive-p t
:pathname "http:www;cl-http;"
:public t)
The CL-HTTP client automatically uses TLS for HTTPS URLs. To control the SSL version and verify behavior:
;; Set default client SSL version (setf *default-client-ssl-version* :tls-1.3) ;; Disable certificate verification for self-signed certs (testing only) (setf *client-ssl-verify-p* nil)
The client negotiates ALPN for HTTP/2 when
*client-http2-enabled* is true (the default).
HTTP/2 requires TLS and uses ALPN (Application-Layer Protocol Negotiation) to upgrade from HTTP/1.1. To enable HTTP/2:
;; Enable HTTP/2 protocol (set-http-version :http/2) (initialize-http2) ;; Then start HTTPS (ALPN is configured automatically) (define-https-service :port 8443 ...)
Important: Call set-http-version and
initialize-http2 before starting the HTTPS service.
ALPN callbacks are registered on the SSL context at service creation time.
Verify HTTP/2 negotiation:
curl -svk --http2 https://localhost:8443/ 2>&1 | grep ALPN * ALPN: server accepted h2
CL-HTTP supports X.509 client certificate authentication. See Using Self-Signed Certificates for detailed instructions on creating a certificate authority and minting client certificates.
To require client certificates on a port:
(define-https-service :port 8443 :certificate #p"http:pw;ssl;server-cert.pem" :private-key #p"http:pw;ssl;server-key.pem" :password :none :certificate-authorities #p"http:pw;ssl;ca.crt" :verify :require :enable-service-p t)
(listening-on-http-ports).
Check that the certificate and key files exist and are readable.(set-http-version :http/2) and
(initialize-http2) before starting the HTTPS service.
Verify: (http2-protocol-enabled-p) should return T.Ports without native SSL/TLS support (such as Symbolics Genera) can use mitmproxy as a TLS termination and origination proxy. mitmproxy handles TLS 1.2/1.3 encryption, HTTP/2, and HTTP/3 (QUIC) while CL-HTTP communicates with it over plain HTTP/1.1 on localhost. This provides full HTTPS capability for the server, client, and proxy subsystems.
mitmproxy is available via package managers on most platforms:
# macOS (MacPorts) sudo port install mitmproxy # Linux (pip) pip install mitmproxy # Or download binaries from https://mitmproxy.org/
Verify installation:
mitmdump --version
mitmproxy terminates incoming TLS connections from external clients and forwards the decrypted requests to CL-HTTP over plain HTTP/1.1 on localhost. This gives external clients HTTPS/H2/H3 access to a CL-HTTP server that only speaks HTTP/1.1.
For development and testing, mitmproxy generates its own CA
certificate on first run (stored in ~/.mitmproxy/).
No certificate setup is needed:
mitmdump --mode reverse:http://localhost:8001 \
--listen-port 8443
Clients connect to https://host:8443/. Since the
certificate is self-signed, use curl -k or install
~/.mitmproxy/mitmproxy-ca-cert.pem in your browser's
trust store.
For production deployment with a certificate trusted by browsers, mitmproxy requires the certificate and private key combined in a single PEM file with the certificate first, then the key:
# Combine certificate chain and private key into one PEM file cat /path/to/fullchain.pem /path/to/privkey.pem > /path/to/combined.pem # Or for self-signed (generated per Section 2 above): cat rsa2048-cert.pem rsa2048-key.pem > combined.pem
Deploy with the --certs option. The *
matches all hostnames; replace with a specific hostname to serve
different certificates per virtual host:
# Single certificate for all hostnames
mitmdump --mode reverse:http://localhost:8001 \
--listen-host 0.0.0.0 \
--listen-port 443 \
--certs *=/path/to/combined.pem
# Per-hostname certificates (virtual hosting)
mitmdump --mode reverse:http://localhost:8001 \
--listen-host 0.0.0.0 \
--listen-port 443 \
--certs www.example.com=/path/to/example-combined.pem \
--certs api.example.com=/path/to/api-combined.pem
If you use Let's Encrypt
via certbot, the certificate
files are in /etc/letsencrypt/live/yourdomain/:
# Combine Let's Encrypt certificate chain and key
cat /etc/letsencrypt/live/yourdomain/fullchain.pem \
/etc/letsencrypt/live/yourdomain/privkey.pem \
> /path/to/combined.pem
mitmdump --mode reverse:http://localhost:8001 \
--listen-host 0.0.0.0 \
--listen-port 443 \
--certs *=/path/to/combined.pem
Set up a cron job or certbot timer to renew and rebuild the combined PEM file. Restart mitmproxy after renewal.
Clients connect to https://host/ and mitmproxy
forwards to CL-HTTP on http://localhost:8001/.
mitmproxy supports HTTP/2 by default on HTTPS connections (ALPN negotiation). For HTTP/3 (QUIC):
# Enable HTTP/3 (experimental in mitmproxy 10+)
mitmdump --mode reverse:http://localhost:8001 \
--listen-port 8443 \
--set http3=true
CL-HTTP sees only HTTP/1.1 requests from mitmproxy. The protocol
upgrade (H2/H3) is handled entirely between the external client and
mitmproxy. Response headers like Alt-Svc for H3 advertisement
are managed by mitmproxy.
For CL-HTTP's client to access external HTTPS sites from a port without native TLS, configure mitmproxy as a forward proxy. The CL-HTTP client sends plaintext HTTP requests to the proxy, which upgrades them to HTTPS for the upstream server. This is required for cloud LLM platforms (Anthropic, Google, OpenAI, xAI) which mandate HTTPS for API access.
# Listen on the subnet shared with the CL-HTTP host
mitmdump --mode regular \
--listen-host 10.0.3.10 \
--listen-port 9443 \
--ssl-insecure
Replace 10.0.3.10 with the proxy host's IP address
on the subnet shared with the CL-HTTP system. The
--ssl-insecure flag disables upstream certificate
verification (acceptable for trusted local networks; omit for
production).
echo "block in quick proto tcp from ! 10.0.3.0/24 to 10.0.3.10 port 9443" \ | sudo pfctl -ef -
;; Direct all HTTPS client requests through the proxy (http:define-client-proxy-mapping :standard-proxies ((:https :default "10.0.3.10" 9443)))
This directs all HTTPS client requests from CL-HTTP through the proxy. The proxy terminates TLS on behalf of CL-HTTP's HTTP client. Local services that use plain HTTP (e.g., LM Studio, Ollama) are not affected.
For ports with native SSL/TLS (LispWorks, SBCL), conditionalize the proxy mapping so it is skipped:
;; Only configure the proxy on ports without native TLS #-CL-HTTP-SSL (http:define-client-proxy-mapping :standard-proxies ((:https :default "10.0.3.10" 9443)))
See http:llm;init-file-example.lisp for a complete
working configuration including LLM platform setup.
mitmproxy handles TLS negotiation with the upstream server, including certificate verification, SNI, and ALPN for HTTP/2.
For ports that need both HTTPS serving and HTTPS client access, run two mitmproxy instances:
# Instance 1: TLS termination for incoming requests
mitmdump --mode reverse:http://localhost:8001 \
--listen-port 8443 &
# Instance 2: Forward proxy for outgoing requests
mitmdump --mode regular \
--listen-host 127.0.0.1 \
--listen-port 8080 &
CL-HTTP configuration:
;; Start HTTP service on the port mitmproxy forwards to (http:enable-http-service :on-ports '(8001)) ;; Configure client proxy for outgoing HTTPS (http:define-client-proxy-mapping "*" "localhost" 8080)
On Symbolics Genera, CL-HTTP runs on the Lisp Machine and mitmproxy runs on a host machine (macOS, Linux) that is network-accessible from the Genera system. The typical setup:
# On the host machine (macOS/Linux):
mitmdump --mode reverse:http://genera-host:8001 \
--listen-host 0.0.0.0 \
--listen-port 8443
For Genera's client to access external HTTPS sites, run a forward proxy on the host and configure CL-HTTP's client proxy mapping to point to it.
~/.mitmproxy/
on first run. For production use, supply your own certificates with
the --certs option. The CA certificate must be trusted
by clients connecting to the proxy.mitmweb instead of mitmdump for a
browser-based traffic inspector useful during development. Or use
mitmdump -v for verbose console logging.Please report bugs to bug-cl-http@cl-http.com.
John C. Mallery -- M.I.T. Computer Science & Artificial Intelligence Laboratory