BlogSNI and TLS
    All posts
    Email InfrastructureNovember 24, 20262 min read

    What Is SNI and How Does It Work with TLS?

    A client sends a hostname to a shared server, which selects a matching certificate, illustrated in cyan and violet

    See how a hostname helps a shared server choose the right TLS certificate, and what to check when a secure connection fails.

    TL;DR

    Server Name Indication (SNI) lets a client include the hostname it wants at the start of a TLS connection. A shared server can use that name to select an appropriate certificate. The client still has to verify the certificate. If a connection fails, compare the configured hostname, the SNI name, and the returned certificate before changing DNS or disabling verification.

    Why does a server need a name?

    A single server address can host many websites or services. When your browser connects to a secure site, the server must present a certificate before it receives an ordinary HTTP request. How can it know which site you want?

    Server Name Indication, or SNI, is a TLS extension that lets the client include the intended hostname in the initial handshake. Transport Layer Security (TLS) establishes an encrypted connection and supports checking the server’s identity. SNI helps the server choose a configuration and certificate for that hostname.

    Follow the handshake

    Imagine two fictional sites, shop.example and support.example, sharing an IP address. Your browser resolves shop.example, connects to the address, and includes shop.example in its TLS ClientHello. The server can use that name to choose the shop certificate. Your browser then checks whether the certificate is trusted, valid, and appropriate for the hostname.

    SNI is a hint for selecting the server configuration; it does not itself authenticate the server or guarantee encryption. Without a recognized name, a server might present a default certificate or reject the connection. A certificate for the wrong name can cause the client’s verification to fail.

    Why does this matter?

    Shared hosting makes it practical for many sites to use the same network address. SNI gives the server the name early enough to select a suitable certificate. This happens behind the scenes when you visit many secure websites; you normally do not have to configure it yourself.

    The hostname in the handshake is normally visible to observers of the connection. Encrypted Client Hello is a separate TLS extension designed to protect sensitive parts of the initial handshake where supported. SNI does not change what the certificate is trusted to prove, and a secure connection still depends on the client checking the server’s identity.

    What if the certificate does not match?

    If your browser reports a certificate error, check that you entered the correct website address. Avoid entering passwords or payment details until the issue is resolved, and contact the site owner if the address is correct.

    If you manage the server, compare the hostname the client sends with the certificate returned. Check that the certificate covers the expected name, is valid, and has a trusted chain. Keep certificate verification enabled while investigating.

    Sources