TLS protects a connection and authenticates according to certificate and trust rules. Correct hostname verification is essential.
Before you start
You should understand clients, servers, IP addresses and ports. Follow a request through name resolution, connection establishment and application exchange. Distinguish protocol guarantees from deployment policy, and use observations from the relevant layer rather than guessing from one browser error message.
The practical goal is to reason through this situation: A valid certificate for another hostname should not authenticate the requested service. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Verify requested hostname
A trusted certificate must authenticate the service the client intended to contact.
Step 2: Inspect validity and chain
Expiry and trust configuration can independently cause failure.
Step 3: Repair the cause
Do not disable verification to conceal deployment errors.
Worked scenario
A valid certificate for another hostname should not authenticate the requested service.
A connection to api.example.test presents a valid certificate for another hostname. Encryption can exist while the intended server identity is unverified. Fix certificate issuance, routing or client trust configuration as appropriate; accepting every certificate turns a meaningful identity failure into an invisible security gap.
Common mistake
Disabling certificate verification removes a core identity check.
Verify the behavior
Test wrong hostname, expired certificate and missing trusted chain separately.
Interview exercise
Investigate a certificate failure.
Answer and reasoning
Check hostname, validity, trust chain and environment configuration; repair the cause rather than bypassing verification.
Continue learning
Compare the scenario with the Networking interview questions and test your understanding with the Networking MCQs. For terminology and implementation details, consult the reference material.