TLS termination

Also known as: SSL offloading

On this page 7

TLS termination is the process in which a load balancer, reverse proxy or gateway ends the encrypted TLS session from the client, decrypts the traffic and passes the plaintext or newly encrypted request to backend servers. The device that terminates the connection holds the server certificate and private key, performs the handshake and becomes the cryptographic endpoint that the client actually talks to. The older name SSL offloading comes from the era of Secure Sockets Layer, the predecessor of Transport Layer Security.

In load balancing, TLS termination is what makes content-aware routing possible. A Layer 7 load balancer cannot read HTTP headers, cookies or URL paths while they are encrypted, so it must terminate TLS before it can apply path rules, sticky sessions based on cookies or web application firewall checks. Terminating at the edge also centralizes certificate management and moves cryptographic work away from application servers.

How a terminating proxy handles a TLS connection

A terminating proxy completes the full TLS handshake on behalf of the backend, so the client never establishes a direct encrypted session with an application server. The client sends a ClientHello that usually contains the requested hostname in the Server Name Indication (SNI) extension. The proxy selects the matching certificate, negotiates the protocol version and cipher suite, and derives session keys through an ephemeral key exchange such as ECDHE.

Once the session is established, the proxy decrypts each record, parses the application protocol, applies routing and security policies and forwards the request to a chosen backend in a separate connection. Responses travel the reverse path and are re-encrypted toward the client. Because the proxy maintains two independent connections, it can reuse persistent backend connections, multiplex HTTP/2 or HTTP/3 streams and enforce timeouts on each side separately.

The table below lists the responsibilities that move to the terminating device.

FunctionWhat the proxy doesWhy it matters
Handshake processingRuns key exchange and authenticationRemoves CPU-heavy work from backends
Certificate selectionChooses a certificate by SNI hostnameServes many domains from one address
Protocol negotiationAgrees on TLS 1.2 or 1.3 and ALPNEnables HTTP/2 and HTTP/3 at the edge
Session resumptionIssues session tickets or PSKsShortens repeat handshakes
Header injectionAdds X-Forwarded-For and X-Forwarded-ProtoPreserves client context for the backend
Functions performed at the termination point

Termination, passthrough and re-encryption patterns

Architects choose among three main deployment patterns, and the choice determines where traffic is visible in plaintext. In plain edge termination, the proxy decrypts and forwards unencrypted HTTP over the internal network. In TLS bridging, also called re-encryption, the proxy decrypts, inspects and then opens a fresh TLS connection to the backend. In TLS passthrough, the load balancer forwards encrypted bytes unchanged and the backend terminates TLS itself.

PatternPlaintext visible atLayer 7 routingTypical use
Edge terminationProxy and internal networkYesTrusted private networks, simple stacks
TLS bridgingProxy onlyYesRegulated data, zero trust networks
TLS passthroughBackend onlyNo, only SNI-based routingEnd-to-end encryption, client certificates at the app
Comparison of TLS handling patterns at the load balancer

Passthrough is compatible only with Layer 4 load balancing or SNI inspection, because the proxy can read the hostname in the unencrypted ClientHello but nothing else. Algorithms such as least connections or IP hash still work, while cookie-based sticky sessions do not. With Encrypted Client Hello (ECH) gaining adoption, even SNI-based routing may require cooperation from the terminating party.

Performance and capacity considerations

The handshake is the expensive part of TLS; bulk encryption is comparatively cheap on modern processors. Asymmetric operations dominate new connections, while symmetric ciphers such as AES-GCM benefit from AES-NI hardware acceleration and ChaCha20-Poly1305 performs well on devices without it. Capacity planning therefore focuses on new handshakes per second rather than raw throughput.

SettingEffectTypical recommendation
Key typeECDSA P-256 signs faster than RSA 2048Prefer ECDSA, keep RSA for legacy clients
TLS versionTLS 1.3 needs one round trip for a full handshakeEnable TLS 1.3, keep TLS 1.2 as fallback
Session resumptionSkips most asymmetric work on reconnectEnable tickets with regular key rotation
0-RTT early dataRemoves a round trip but allows replayLimit to idempotent requests or disable
OCSP staplingSaves clients a revocation lookupEnable when the CA supports it
Settings that influence termination performance

Dedicated hardware accelerators were once common in SSL offloading appliances. Today, general-purpose CPUs handle most workloads, and software proxies such as HAProxy, NGINX or Envoy terminate tens of thousands of handshakes per second per server, depending on key type, core count and resumption rate.

Security trade-offs of terminating at the edge

Terminating TLS concentrates both control and risk in one tier. On the positive side, the security team can enforce a single minimum protocol version, disable weak cipher suites everywhere at once, rotate certificates automatically with ACME and place a web application firewall where it can see decrypted requests. Backends no longer need private keys, which reduces the number of places where a key can leak.

On the negative side, the terminating proxy becomes a high-value target holding many private keys, and any traffic forwarded in plaintext is exposed to anyone who can observe the internal network. Compliance frameworks such as PCI DSS and zero trust architectures increasingly expect encryption on every hop, which pushes deployments toward TLS bridging or mutual TLS between proxy and backend. Keys should be stored with restricted permissions, ideally in a hardware security module or a managed key service.

Common configuration mistakes

Most production incidents involving TLS termination come from lost context or incomplete chains rather than broken cryptography. The table below pairs typical symptoms with their causes and fixes.

SymptomLikely causeFix
Redirect loop between HTTP and HTTPSBackend thinks the request arrived over HTTPHonor X-Forwarded-Proto in the application
All clients appear to share one IP addressClient address replaced by the proxyRead X-Forwarded-For or use PROXY protocol
Some mobile clients fail to connectMissing intermediate certificateServe the full certificate chain
Certificate expires without warningManual renewal on several proxiesAutomate issuance and monitor expiry
Wrong certificate for a hostnameSNI mapping missing or default usedMap every hostname explicitly
Symptoms, causes and fixes

A further subtle mistake is trusting forwarded headers from any source. Backends should accept X-Forwarded-For only from the known proxy addresses; otherwise a client can forge its apparent IP address and bypass access controls or rate limits.

The short version

Think of a large office building with a front desk that opens all incoming sealed mail. The front desk checks each letter, sees which department it belongs to and walks it to the right floor. The departments never have to open envelopes themselves, and only the front desk keeps the letter opener.

TLS termination works the same way for websites. Encrypted traffic arrives at the load balancer, which unlocks it, reads where it should go and passes it to the right server. This saves the servers work and keeps the keys in one place, but it also means the front desk must be very well protected.

Where it makes a difference

An online retailer runs twelve application servers behind a pair of Layer 7 load balancers. Before the redesign, each server held its own certificate, and renewals were handled by hand, which caused two expired-certificate outages in one year. The team moved termination to the load balancers, issued ECDSA certificates through ACME automation and enabled TLS 1.3 with session resumption.

Because the load balancers could now read URL paths, the team routed /api/ traffic to a dedicated server pool and attached a web application firewall to checkout requests. Payment card rules required encryption inside the data center, so the load balancers re-encrypt traffic to the checkout pool using an internal certificate authority. The result was automated renewals with no further outages, lower CPU usage on application servers and a single place to retire TLS 1.0 and 1.1.