## TL;DR
Certificate chain problems only show up from the client's perspective: the server looks fine locally while clients fail because an intermediate is missing or misordered. Test the full chain exactly as clients see it before deploy: fetch the served chain, verify it against real trust stores, and check expiry of every cert in the chain, not just the leaf. Five minutes of testing prevents the classic expired-intermediate outage.

## The query
```text
how to test TLS certificate chains before deploy
```

## Use this when
- Deploying new or renewed certificates
- Clients report TLS errors that browsers do not show
- Debugging chain issues (missing intermediates)
- Before any cert change in production

## Not for when
- Obtaining certificates (ACME, CA processes)
- TLS protocol or cipher tuning
- Debugging application-level HTTPS issues

## Steps

### Step 1: Fetch the chain as clients see it
Connect to the staging endpoint (or the new cert on a test port) and dump the presented chain. Compare it against the expected chain: leaf plus intermediates in order, root optionally included. What the server presents is what matters, not what is in your files.
Expected output: the served chain captured and compared to the expected one.

### Step 2: Verify against real trust stores
Validate the chain with the trust stores your clients use: system stores, Java cacerts, mobile OS stores. A chain that validates on your laptop may fail on older Android or a minimal container image with a sparse CA bundle.
Expected output: validation passing on every client platform you support.

### Step 3: Check every certificate's expiry, not just the leaf
Intermediates expire too, and an expiring intermediate is the classic surprise outage. Check notAfter on each cert in the chain and alert on all of them, with the same urgency as the leaf.
Expected output: expiry dates for the full chain recorded; monitoring covers intermediates.

### Step 4: Test renewal in staging first
Run the full renewal and deploy flow against staging, then run steps 1-3 against the result. Renewal automation breaks in ways that only show up end to end: wrong chain file assembled, deploy step skipped, old cert cached.
Expected output: a proven renewal path, tested before the production expiry forces you to use it.

### Step 5: Monitor continuously after deploy
Keep automated checks on the live chain: validity, expiry, and consistency across all serving endpoints. Certs are time bombs; the monitoring is the fuse box.
Expected output: alerts fire weeks before any expiry, on every endpoint.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_C9PcDEqmWbOWnomxvAm5jw
