Skip to content
AI Engineer Guide.

concept · basics · intermediate · concept 24 of 24

TLS, DNS, proxies

0 of 24 complete

Why it matters

A request that times out has failed at one of several layers, and the error message usually names only the last one. Distinguishing a name resolution failure from a connection refusal, a handshake failure and an application timeout requires knowing what each layer does and where its evidence lives. That knowledge turns a vague connectivity problem into a specific check.

Mental model

It is a postal route: the address is resolved, a road is chosen, a sealed envelope is handed over, and a depot may repackage it. The analogy breaks because the seal is verified at every hop that terminates TLS, and the depot can open the envelope if it holds the key.

How it works

Mechanism, step by stepInteractive
  1. 1Resolve the name first and confirm which address and record type the client receives.
  2. 2Test the transport connection separately from the handshake, so a refusal and a certificate error are not confused.
  3. 3Verify the chain, hostname and validity window from the client's trust store, not from a browser that may hold an exception.
  4. 4Check for proxies and load balancers that terminate TLS, and read the forwarded headers they add.
  5. 5Measure connection reuse and handshake time separately from request time.
  6. 6Confirm DNS TTL and resolver caching before expecting a routing change to take effect.

Step 1 of 6

Resolve the name first and confirm which address and record type the client receives.

Step 1/6 · step 1

Figure. The mechanism in this page's own steps. The figure adds sequence, not new claims.

What to notice. A step can be read alone, but the order is the mechanism. The control lets you stop on any one.

Text version

The page's steps: 1. Resolve the name first and confirm which address and record type the client receives. 2. Test the transport connection separately from the handshake, so a refusal and a certifica… 3. Verify the chain, hostname and validity window from the client's trust store, not from a … 4. Check for proxies and load balancers that terminate TLS, and read the forwarded headers t… 5. Measure connection reuse and handshake time separately from request time. 6. Confirm DNS TTL and resolver caching before expecting a routing change to take effect.

  1. Resolve the name first and confirm which address and record type the client receives.
  2. Test the transport connection separately from the handshake, so a refusal and a certificate error are not confused.
  3. Verify the chain, hostname and validity window from the client's trust store, not from a browser that may hold an exception.
  4. Check for proxies and load balancers that terminate TLS, and read the forwarded headers they add.
  5. Measure connection reuse and handshake time separately from request time.
  6. Confirm DNS TTL and resolver caching before expecting a routing change to take effect.

Trade-offs

ChoiceGood forCostFails when
Termination at the edgeCentral certificate management and inspectionPlaintext inside the network after terminationThe internal network is untrusted
End-to-end encryptionConfidentiality to the originCertificate distribution to every serviceYou cannot automate certificate rotation
Long keep-aliveFewer handshakesIdle connections consume capacityTraffic is bursty across many clients
Short DNS TTLFast failoverMore resolver loadResolvers ignore the TTL
Trade-off mapInteractive

Good for

Central certificate management and inspection

Cost

Plaintext inside the network after termination

Fails when

The internal network is untrusted

  1. The internal network is untrusted
  2. You cannot automate certificate rotation
  3. Traffic is bursty across many clients
  4. Resolvers ignore the TTL

Figure. Each choice with what it buys, what it costs, and the case where it loses.

What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.

Text version

Four trade-offs: Termination at the edge is good for Central certificate management and inspection, costs Plaintext inside the network after termination, and fails when The internal network is untrusted. End-to-end encryption is good for Confidentiality to the origin, costs Certificate distribution to every service, and fails when You cannot automate certificate rotation. Long keep-alive is good for Fewer handshakes, costs Idle connections consume capacity, and fails when Traffic is bursty across many clients. Short DNS TTL is good for Fast failover, costs More resolver load, and fails when Resolvers ignore the TTL

Failure modes

  • Expired certificate. Handshakes fail for every new connection while established ones keep working. Debug: read the not-after date from the served chain with a client that verifies, and alert before expiry.
  • Hostname mismatch. The certificate is valid for a different name and only some clients fail. Debug: compare the requested hostname with the subject alternative names in the served certificate.
  • Path MTU or proxy limit. Large responses hang while small ones succeed. Debug: measure the response size at which the request stalls and check path MTU and proxy body limits.

In production

Monitor certificate expiry, handshake failure rate and connection setup latency per region. Keep an alert well before expiry and a rotation procedure that does not depend on one person.

Common misconceptions

People think: TLS makes the request end-to-end encrypted.

Actually: It encrypts each leg; a terminating proxy decrypts and re-encrypts, so the guarantee depends on where termination happens.

People think: A DNS change takes effect immediately.

Actually: Resolvers and clients cache records for the TTL, and some ignore it, so failover time is not the same as change time.

Interview angle

Walk the layers and name a distinct check for each, including chain, hostname and clock. Explain where termination happens and why TTL bounds failover. Checking the certificate and stopping there leaves most of the path unexamined.

Sources