One IP address can serve many HTTPS sites. The server decides which certificate to send from a name the client puts in the handshake. When a site shows the wrong certificate, I want to control that name myself.
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null | openssl x509 -noout -subject
-servername sets the TLS SNI extension (Server Name Indication) in the ClientHello. If you leave it out, the docs say SNI is filled with the name you gave to -connect, as long as that looks like a DNS name. If -connect is missing too, it is set to localhost. That is why connecting to a bare IP address sends no useful name, and a server with several sites on it may answer with a default certificate.
I did run a local test with openssl s_server holding two certificates. Without -servername I got the default one. With -servername other.test I got the other one. Same IP, same port, different subject.
Two details. The name is sent whether or not it is a DNS name, even an IP address. And -noservername does the opposite and leaves the extension out, which is a quick way to see what a server does for clients that send no name. You can’t combine the two options.
This also helps when you test a new server before DNS points to it. Connect to the new IP and pass the real name with -servername.
Further reading: openssl-s_client documentation
Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get