Server Name Indication (SNI) is an extension of the TLS protocol that lets a client tell a server which hostname it wants to reach during the handshake, before the encrypted connection is established. You enter a hostname and port; the server uses that name to select the correct certificate and present it, enabling multiple HTTPS sites to share one IP address.
What SNI Solves
Before SNI (introduced in 2003 in RFC 3546), a server could only present one certificate per IP address. If you wanted to host a.com and b.com on the same server, you needed two IP addresses or a shared certificate that listed both names (which caused browser warnings for mismatches). SNI allows the client to specify the hostname early, so the server can choose the correct certificate from a pool. This made virtual hosting of HTTPS sites practical and is now used by virtually every public HTTPS website.
How SNI Works in the TLS Handshake
When a client connects to a server over HTTPS, the TLS handshake begins with the ClientHello message. This message includes, among other fields, the SNI extension containing the hostname the client wants. The server reads that name and replies with the appropriate certificate chain. The entire process happens in plaintext before encryption starts, which is a deliberate design choice so the server can route the connection. After the certificate exchange, the rest of the handshake proceeds normally, and all subsequent data is encrypted.
Choosing a Hostname for SNI
When you set up a server or test a TLS connection, the hostname you provide must match the certificate’s Subject Alternative Name (SAN) exactly. A few practical points:
- Use the fully qualified domain name (FQDN) without a trailing dot, e.g.,
www.example.com, notwww.example.com.(though some servers accept the trailing dot). - For IP addresses, SNI is not typically used because certificates are issued for hostnames, not IPs (though IP SANs exist).
- Wildcard certificates like
*.example.comcover one level of subdomains, sowww.example.comworks butblog.www.example.comdoes not.
Common Problems and Misconceptions
One frequent issue is the “SNI is not sent” error, which happens when a client (like an old browser or a custom script) omits the SNI extension. The server then cannot select the right certificate and may present a default one, causing a hostname mismatch. Another misconception is that SNI encrypts the hostname; it does not. The hostname is visible to network observers, which is why Encrypted Client Hello (ECH) was developed to hide it, though ECH is not yet widely deployed. Also, SNI is only for TLS; it does not apply to plain HTTP (port 80) where the Host header is used instead.
Alternatives to SNI
If SNI is not available or you need to host multiple certificates on one IP without SNI, you have a few options:
- Dedicated IP addresses – assign each site its own IP, but this is costly and wasteful.
- Shared certificate – use a certificate that lists multiple hostnames (SAN), but this requires all sites to trust the same entity and can be unwieldy.
- Reverse proxy – route traffic through a proxy that terminates TLS and forwards based on the Host header, but the proxy still needs the SNI to pick the certificate.
- Encrypted Client Hello (ECH) – a newer extension that hides the SNI inside a public key, but it requires both client and server support.
Safety and Privacy Considerations
Because SNI is sent in plaintext, anyone watching the network can see which hostname you are visiting, even if the content is encrypted. This can leak the site you are accessing, which is a privacy concern in censored or monitored networks. To mitigate this, you can use a VPN or Tor, which encrypt the entire connection before TLS, or use ECH when available. For server administrators, ensure your certificates are valid and match the SNI hostname to avoid browser warnings. There is no inherent security risk in SNI itself, but it is a metadata exposure to be aware of.
Frequently Asked Questions
What does SNI stand for?
SNI stands for Server Name Indication. It is a TLS extension defined in RFC 3546 and later updated in RFC 6066.
Is SNI required for HTTPS?
Most modern browsers and servers require SNI for HTTPS because they assume it is available. If SNI is missing, the server may present a default certificate, which usually causes a name mismatch error. Some legacy systems might still work without SNI if only one site is hosted per IP, but that is rare today.
Does SNI work with IP addresses?
SNI is designed for hostnames, but the extension technically allows an IP address as the “host_name”. However, certificates are rarely issued for IP addresses, and many servers ignore SNI when the connection is to an IP. It is best practice to use a hostname.
Can SNI be spoofed or faked?
Yes, a client can send any hostname in the SNI field. That is not a security vulnerability by itself; the server still validates the certificate and the client verifies it. However, it means SNI is not a reliable authentication mechanism. It is only used for routing and certificate selection.
What is the difference between SNI and the Host header?
The Host header is an HTTP/1.1 feature sent after the TLS handshake, inside the encrypted request. SNI is sent during the TLS handshake, before encryption, so the server can select the certificate. Both carry the hostname, but SNI is lower-level and visible to network observers.
How do I test if SNI is working?
You can use tools like openssl s_client -connect example.com:443 -servername example.com to see which certificate is presented. If the certificate matches the hostname, SNI is working. Alternatively, use an online SSL checker that shows the certificate for a given hostname.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Samsung Smart Speaker Rollable Display: Facts
- HP 9730e: Wide Prints, Not A3 Scans
- What 8888 Does When You Use It as DNS Server
- Credential Manager: Seamless Sign-In Explained
- API Governance for Public Data: What Growing Portfolios Need
- Enterprise AI Hidden Cost: Data Architecture ROI