Server Name Indication (SNI)
You'll learn how SNI solves the problem of hosting multiple HTTPS websites on a single IP address by revealing the hostname early in the TLS handshake.
The IP Address Dilemma
Before SNI, hosting multiple HTTPS sites on one IP address was problematic. Here's why: when a client initiates a TLS connection, the server must present its digital certificate before knowing which website the client wants. Without the hostname, the server couldn't pick the right certificate.
Think of it like a hotel receptionist who needs to hand you your room key before you tell them your name—they'd have to guess which key to give you!
How SNI Works
SNI extends the TLS handshake by including the hostname (e.g., example.com) in the initial ClientHello message—the very first step when establishing a secure connection. This happens before encryption begins, so the server can read the hostname in plain text.
With the hostname known upfront, the server can:
- Select the correct digital certificate for that domain
- Load the appropriate TLS configuration
- Respond with the right
ServerHelloand certificate
This enables virtual hosting for HTTPS, just like HTTP has always supported—multiple domains sharing one IP address.
Real-World Impact
SNI is crucial for:
- Shared hosting providers serving thousands of HTTPS sites from limited IP addresses
- CDNs delivering content for many customers through shared infrastructure
- Cloud platforms maximizing resource efficiency
The trade-off? The hostname travels unencrypted during the handshake, potentially revealing which site you're visiting (though newer standards like Encrypted Client Hello aim to address this).
Key Takeaway: SNI lets servers host multiple HTTPS sites on one IP address by including the destination hostname in the TLS handshake's ClientHello message, enabling proper certificate selection before encryption begins.