Skip to Content
TroubleshootingSSL Errors

SSL Errors

tls: certificate not trusted

The client doesn’t trust the APXY root CA:

# Option 1: Pass the CA to curl curl -x http://localhost:8080 --cacert certs/ca.crt https://example.com # Option 2: Trust system-wide (macOS) sudo apxy certs trust # Option 3: Regenerate certs rm -rf certs/ apxy certs generate

Proxy starts but HTTPS requests fail

  1. Verify the CA exists:
    apxy certs info
  2. Verify the cert files exist:
    ls -la certs/
  3. Try regenerating:
    rm -rf certs/ apxy certs generate sudo apxy certs trust

Certificate not trusted after regeneration

On macOS, you need to re-trust the new CA:

rm -rf certs/ apxy start # macOS will prompt for your password to trust the new CA

Or manually:

apxy certs generate sudo apxy certs trust

Per-tool certificate trust

Some tools don’t use the system certificate store:

# cURL curl --cacert ~/.apxy/certs/ca.crt https://example.com # Node.js export NODE_EXTRA_CA_CERTS=~/.apxy/certs/ca.crt # Python (requests) export REQUESTS_CA_BUNDLE=~/.apxy/certs/ca.crt

502 Bad Gateway with X-Apxy-Error: upstream_certificate

When APXY decrypts HTTPS, it checks the server’s certificate the way a browser does. The response body names the host and the reason, such as an expired, self-signed, or wrong-host certificate. APXY does not check localhost, *.localhost, and loopback IP addresses.

Fix the certificate if you can. The request usually fails without APXY too. To accept any server certificate, for example on a staging server with a self-signed certificate:

apxy start --insecure-upstream apxy run --insecure-upstream --mitm-all -- npm test

SSL interception not working for a domain

HTTPS MITM is opt-in by default. Enable it for the domain:

apxy ssl enable --domain api.example.com

Or create a mock rule for that domain — APXY automatically enables SSL interception for mocked domains.

Last updated on