Skip to content

Client certificates

Some servers ask the client for a certificate of its own during the TLS handshake (mutual TLS). zhttp makes its own connection to the server, so the server’s request comes to zhttp, not to the app. Give zhttp the certificate, and it presents it for the hosts you name.

  1. Open Settings → Certificates. Client certificates is under the zhttp CA.
  2. Type the host it is for, such as api.example.com, or a pattern such as *.example.com.
  3. Click Choose files… and pick the certificate and its key: one file that holds both, or the two files together.
  4. For a .p12 or .pfx file, type its password.
  5. Click Add (or press Enter).

zhttp reads:

Files
.p12, .pfx PKCS#12, with its password
One .pem The certificate and its private key
A certificate and a key The certificate in PEM or DER (.pem, .crt, .cer, .der), the key in another file (.key, .pem)

The private key must not be encrypted; export it without a password, or as a .p12. A certificate chain in the file is sent with the certificate.

Each certificate is listed with its host or pattern, whose it is and when it expires. An expired one shows its date in amber. The × removes it.

  • Patterns work as in SSL proxying: *.example.com also matches example.com. A host named exactly wins over a pattern.
  • zhttp keeps its own copy, so the file you added from, and its password, aren’t needed again.
  • Every session uses the certificates, and so do replay, the composer and map remote.
  • A certificate is presented only to a server that asks for one, and only on hosts zhttp decrypts. A host with SSL proxying off goes straight to the server, which then asks the app.

When a server asks for a certificate and none is kept for its host, zhttp answers with none. The connection’s notices, in the inspector’s Connection tab, say asked for a client certificate, and none is kept for this host. If the server then refuses the handshake, the TLS tab’s Likely cause says the same.