Scrivio Interview library
ConceptFoundations6 min read · updated 13 November 2026

TLS encrypts traffic between client and server. A load balancer or proxy can terminate TLS (decrypt it), pass it through untouched to the backend, or terminate and re-encrypt to the backend. Mutual TLS also authenticates the client with a certificate.

Compare termination, passthrough and re-encryption, and explain what mTLS adds and what the handshake costs.

Termination decrypts at the load balancer, centralising certificates and enabling layer 7 routing and logging, but leaves the balancer-to-backend hop in plaintext. Passthrough forwards encrypted bytes so encryption is end to end and the key stays on the backend, but the balancer can only route at layer 4 or by the SNI name. Re-encryption terminates and opens a new TLS connection to the backend, giving layer 7 features and encryption in transit at the cost of a second handshake and more certificates. mTLS makes the client prove its identity with a certificate too, and a TLS 1.3 handshake costs one round trip after TCP, with resumption and 0-RTT reducing it further.

Why this question is asked

Where TLS ends is one of the first decisions in any service's network path, and it affects security, what the load balancer can do and latency. Interviewers ask this to see whether we can compare the options precisely and know what mutual TLS and handshakes actually cost. In this answer, we will recap what TLS does, compare termination, passthrough and re-encryption, explain mTLS, and count the round trips of a handshake.

1A Quick Recap: What TLS Gives Us

TLS, Transport Layer Security, protects a connection in two ways. It encrypts the bytes so nobody on the path can read or change them, and it authenticates the server: the server presents a certificate, signed by a certificate authority the client trusts, proving it owns the name the client asked for. Whoever terminates TLS, meaning holds the private key and decrypts the traffic, can see the plain HTTP request. So the question of where to terminate is really a question of who may see the plaintext and who must hold keys.

2Termination, Passthrough and Re-Encryption

With termination at the load balancer, the client's TLS connection ends there. The balancer holds the certificates, decrypts each request and sees the HTTP method, path and headers, so it can route by path, add headers, log requests and apply rules. Certificates live in one place. The cost is that the hop from the balancer to the backend is plain HTTP unless we do something more, which may be acceptable inside a trusted network and is often not acceptable under compliance rules.

With passthrough, the balancer does not decrypt anything. It forwards the encrypted TCP stream to a backend, which terminates TLS itself. Encryption is end to end and the private key exists only on the backends. But the balancer cannot see HTTP, so it can only route at layer 4, by address and port, or by the SNI name, the server name the client sends in clear text at the start of the handshake.

With re-encryption, sometimes called TLS bridging, the balancer terminates the client's TLS, reads the HTTP, and then opens a new TLS connection to the backend. We get the layer 7 features and encryption on every hop. The cost is a second handshake on the backend connection, though pooled connections amortise it, and a second set of certificates to manage on the backends.

Where TLS ends
ModeBalancer sees HTTP?Encrypted to backend?Main cost
Terminationyes, layer 7 routingno, plaintext hopplaintext inside the network
Passthroughno, layer 4 or SNI onlyyes, end to endno path routing, keys on backends
Re-encryptionyes, layer 7 routingyes, new TLS sessionsecond handshake, more certificates
Re-encryption is the common choice when both layer 7 features and encryption in transit are required.

3What Mutual TLS Adds

In ordinary TLS, only the server proves its identity. With mutual TLS, mTLS, the server also sends a CertificateRequest during the handshake, the client presents its own certificate and proves it holds the matching private key, and the server verifies the certificate against the certificate authorities it trusts for clients. Now both sides know who they are talking to, using cryptography rather than shared secrets like API keys.

mTLS is common between internal services, where a service mesh such as Istio or Linkerd issues every workload a short-lived certificate and enforces mTLS automatically, and with partners, where each partner receives a client certificate from a dedicated CA. In Spring Boot, the server side is a few properties.

Properties
server.ssl.bundle=server
server.ssl.client-auth=need # handshake fails without a valid client certificate
spring.ssl.bundle.pem.server.keystore.certificate=classpath:tls/server.crt
spring.ssl.bundle.pem.server.keystore.private-key=classpath:tls/server.key
spring.ssl.bundle.pem.server.truststore.certificate=classpath:tls/client-ca.crt
# truststore: the CA that issued the clients' certificates

4What the Handshake Costs

Before any application data flows, the client and server need a TCP handshake, one round trip, and a TLS handshake. In TLS 1.2 a full handshake took two round trips. TLS 1.3 needs only one: the client sends its key share in the first message, the server replies with its own, its certificate and its Finished message, and the client can send the request right after. On a 100 millisecond round trip, that is the difference between about 300 and 200 milliseconds before the first request byte is sent. There is also CPU cost: the server signs the handshake with its private key, which is the expensive part under heavy reconnect load.

Two features reduce the cost for returning clients. Session resumption lets a client that connected recently skip the certificate exchange and signature, reusing keys from a previous session through a session ticket. 0-RTT early data in TLS 1.3 goes further and lets a resuming client send its first request in the very first message. But early data can be replayed by an attacker who captures it, because the server cannot fully tell a replay from the original, so it is safe only for idempotent requests such as GET.

Step throughTLS 1.3 full handshake over TCP
ClientServer
TCP SYN
SYN-ACK
ACK + ClientHello, key share
ServerHello, key share, certificate, Finished
Finished + HTTP request
HTTP response

6 messages in order. Play them, or step through them one at a time.

One round trip for TCP and one for TLS 1.3 before the request; TLS 1.2 needed one more.

5Follow-up questions

Where does the client IP go when TLS is passed through?

With passthrough the balancer cannot add an X-Forwarded-For header, because it cannot see or change the encrypted HTTP. The backend's TCP connection comes from the balancer, so it sees the balancer's address. The usual fixes are the PROXY protocol, where the balancer sends a short header with the original client address at the start of the TCP connection, which the backend server must be configured to read, or a balancer mode that preserves the client's source address on the packets, as some network load balancers do.

Is plaintext between the balancer and the backend acceptable?

It depends on the threat model and the rules. Inside a private network with strict access control, many teams accept it for ordinary data. For regulated data, such as card data or health records, or in zero-trust designs where the internal network is not trusted, encryption in transit on every hop is expected, which means re-encryption or passthrough.

6Conclusion

In this answer, we saw that termination centralises certificates and enables layer 7 features but leaves a plaintext hop, passthrough keeps encryption end to end with only layer 4 or SNI routing, and re-encryption gives both at the cost of a second handshake and more certificates. mTLS adds client authentication with certificates, common between services and with partners, and a TLS 1.3 handshake costs one round trip after TCP, with resumption saving the expensive work and 0-RTT saving a round trip only for idempotent requests.

What to say in the interviewAbout 90 seconds aloud

Open with

There are three places TLS can end. With termination at the load balancer, the balancer holds the certificates and decrypts, so it can route by path, add headers and log, and certificates are managed in one place, but the hop to the backend is plaintext.

Then, if they want more

With passthrough, the balancer just forwards the encrypted stream, so encryption is end to end and the private key only lives on the backend, but routing is limited to layer 4 or the SNI name in the handshake, and the backend loses the client IP unless we use something like the PROXY protocol.

With re-encryption, the balancer terminates, reads the HTTP, and opens a new TLS connection to the backend, so we get layer 7 features and encryption in transit, at the cost of a second handshake, which pooling mostly hides, and more certificates.

Mutual TLS adds client authentication: the server sends a CertificateRequest, the client presents a certificate, and the server verifies it against trusted CAs. It is common between services in a mesh and with partners. For cost, TCP takes one round trip, and TLS 1.3 a full handshake takes one more, where TLS 1.2 took two.

Resumption skips the expensive signature for returning clients, and 0-RTT saves a further round trip but can be replayed, so I would only allow it for idempotent requests.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Compare termination, passthrough and re-encryption, and explain what mTLS adds and what...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/8e85d222a1/