What Is SNI in SSL? SNI Explained
SNI in SSL is the extension that lets one IP address serve many HTTPS sites. Server Name Indication (SNI) is an extension to TLS, defined in RFC 6066, that lets a client state the hostname it wants during the handshake, before any HTTP request arrives.
The problem SNI solves in SSL
Plain HTTP solved shared hosting early. The browser sends a Host header and the server picks the right site. With HTTPS, the certificate must be sent first, before any HTTP request. In the early days of SSL this forced one IP address per certificate, which was costly and ran into IPv4 shortages.
SNI fixes this by putting the hostname in the first message of the handshake, the ClientHello. The server reads it, picks the matching certificate and carries on. That is how a single server can host hundreds of HTTPS sites on one address.
How the SSL handshake uses SNI
- The browser opens a TCP connection to the server IP on port 443.
- It sends a ClientHello that includes the server name, for example
blog.example.com. - The server looks up a certificate that covers that name.
- It replies with that certificate and the handshake finishes.
- If no name matches, the server falls back to a default certificate, which usually triggers a name mismatch warning.
What SNI does not hide
The hostname in a classic ClientHello is sent in plain text. Anyone on the network path can see which site you connect to, even though the page content is encrypted. Encrypted Client Hello (ECH) is a newer extension that aims to hide it, but support depends on both the browser and the server or CDN, so check your provider's current documentation before counting on it.
Server configuration
In Nginx, each server block names its host and certificate. SNI does the matching automatically:
server {
listen 443 ssl;
server_name site-a.example;
ssl_certificate /etc/ssl/site-a/fullchain.pem;
ssl_certificate_key /etc/ssl/site-a/privkey.pem;
}
server {
listen 443 ssl;
server_name site-b.example;
ssl_certificate /etc/ssl/site-b/fullchain.pem;
ssl_certificate_key /etc/ssl/site-b/privkey.pem;
}Both blocks listen on the same IP and port. For a full walkthrough of the layout, see how to secure multiple websites on one server.
Testing SNI
You can see the difference with OpenSSL. The first command sends a name, the second sends none:
openssl s_client -connect 203.0.113.10:443 \
-servername site-a.example </dev/null | head -20
openssl s_client -connect 203.0.113.10:443 \
-noservername </dev/null | head -20If the second command returns a different certificate, that is the server's default. This is also the quickest way to find out why a browser shows the wrong certificate when you test by IP address.
Compatibility
Every current browser and operating system supports SNI. The few clients that lack it are very old systems and some outdated scripts or embedded devices. If you must serve such a client, the usual options are a dedicated IP or a certificate that lists all the names, which you can learn more about in getting free SSL for multiple domains.
| Setup | SNI needed? | Notes |
|---|---|---|
| One site on one IP | No | The default certificate is always the right one |
| Many sites, one IP | Yes | Each site gets its own certificate |
| CDN in front | Handled by the CDN | Origin may still use SNI for its own certificate |
| Multi-name (SAN) certificate | No | One certificate covers all names listed |
Common problems
- Wrong certificate shown. The server has no block for that name, so the default is returned. Add the host or fix the
server_name. Also review how DNS records affect SSL if the name points to the wrong server. - Proxy loses the name. A reverse proxy that connects to a backend without sending a server name can get the wrong certificate. Enable the proxy's SNI option. See Fix SSL on Nginx Proxy Manager and Caddy.
- Testing by IP. Browsers send no useful name when you visit an IP address, so you get the default certificate. Use the hostname or
--resolvein curl.
curl -I --resolve site-a.example:443:203.0.113.10 \
https://site-a.example/SNI also matters for certificate issuance. Challenges such as TLS-ALPN-01 rely on the server name to pick the right certificate, so a good understanding of SNI helps when debugging validation.
Key takeaways
- SNI puts the hostname in the ClientHello so the server can choose a certificate.
- It lets many HTTPS sites share one IP address.
- The name is sent unencrypted unless Encrypted Client Hello is in use.
- Test with
openssl s_client -servernameandcurl --resolve.
Related reading: securing multiple websites on one server, HTTPS for Cloudflare subdomains and free SSL for a subdomain.
Frequently Asked Questions
Does SNI cost anything?
No. It is part of the TLS handshake and needs no certificate or service of its own.
Does SNI hide the hostname?
No, it sends the hostname in clear text during the handshake. Encrypted Client Hello is the newer work aimed at that gap.
Do all browsers support SNI?
Every current browser does. The failures come from old embedded clients, old Java versions and some command line tools, not from modern browsers.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.