Skip to content

Domain Names, DNS, and HTTPS

Foreword

When you type www.google.com in your browser and press Enter, what happens behind the scenes? This seemingly simple action involves a series of precisely coordinated processes: domain name resolution, DNS queries, and TLS encryption handshakes. Understanding these mechanisms is essential for every developer — it directly determines whether your website can be accessed and whether your data can be intercepted.

What will you learn from this article?

After completing this chapter, you will gain:

  • DNS Principles: Understand the complete process of how domain names are translated into IP addresses
  • Record Types: Master the uses of common DNS records like A, CNAME, and MX
  • HTTPS Mechanisms: Understand how TLS handshakes establish secure connections
  • Certificate System: Learn about the trust chain of digital certificates and verification mechanisms
  • Security Awareness: Understand why HTTPS is the baseline requirement for the modern web
ChapterContentCore Concepts
Chapter 1DNS ResolutionRecursive queries, iterative queries
Chapter 2DNS RecordsA, CNAME, MX, TXT
Chapter 3HTTPS and TLSHandshake process, encrypted communication
Chapter 4Certificate Trust ChainCA, root certificates, intermediate certificates
Chapter 5HTTP vs HTTPSPlain text vs encrypted, security comparison

0. Big Picture: From Domain Names to Secure Connections

Internet communication is based on IP addresses (like 142.250.80.46), but humans can't remember these numbers. So we invented the Domain Name System (DNS) — the internet's "phonebook" that translates human-readable domain names into machine-readable IP addresses.

But finding the server isn't enough. If communication is transmitted in plain text, any man-in-the-middle can eavesdrop on or tamper with your data. HTTPS solves this problem — it adds a layer of TLS encryption on top of HTTP, ensuring the confidentiality and integrity of data during transmission.

A Complete Web Page Visit

  1. Domain Resolution: The browser asks DNS "What's the IP for www.google.com?" DNS responds "142.250.80.46"
  2. TCP Connection: The browser establishes a TCP three-way handshake with the server
  3. TLS Handshake: Both parties negotiate encryption algorithms, verify certificates, and exchange keys
  4. Encrypted Communication: All HTTP data is transmitted through the encrypted channel

1. DNS Resolution: The Internet's "Phonebook"

DNS (Domain Name System) works like looking up a phonebook: you know the other person's name (domain name) and need to find their phone number (IP address). But the internet's "phonebook" isn't a single book — it's a hierarchical, distributed system.

🔍 DNS Resolution Simulator

🌐
Browser cache
💻
OS cache
🔄
Recursive resolver
🌍
Root name server
📂
TLD server
🏠
Authoritative DNS server
Resolution flow: When the browser visits a website, it first translates the domain name into an IP address. This process checks multiple caches and servers until the matching IP is found.

Four Steps of DNS Resolution

  1. Browser Cache: Check the local cache first. If you've visited this domain before, use the cached IP directly
  2. Recursive Resolver: If the cache misses, the request goes to the ISP's recursive resolver (like 8.8.8.8)
  3. Hierarchical Query: The recursive resolver asks the root name server → top-level domain server (.com) → authoritative name server (google.com) in sequence
  4. Return Result: The authoritative server returns the final IP, the recursive resolver caches the result and returns it to the browser
LevelServerResponsibilityCount
RootRoot ServerKnows the addresses of all top-level domains13 groups globally
Top-level DomainTLD ServerManages .com, .cn, .org, etc.One group per suffix
AuthoritativeAuthoritativeStores DNS records for specific domainsAt least 2 per domain
Recursive ResolverResolverCompletes the entire query process on behalf of the userISP or public DNS

2. DNS Record Types: The "Configuration Table" Behind Domain Names

DNS does more than just translate domain names to IPs. Through different types of DNS records, you can control email delivery, domain redirection, service discovery, and more. Understanding these record types is fundamental for configuring domain names and troubleshooting network issues.

📋 DNS Record Type Cheatsheet

AAddress record

Maps a domain name to an IPv4 address. This is the most common DNS record type and is ultimately what browsers need when visiting a site.

Example record
example.com. IN A 93.184.216.34
Common uses
  • Point a website domain to a server IP
  • Point subdomains to different servers
  • Return multiple IPs for load balancing
Tip: DNS does more than translate domains into IP addresses. It also supports mail routing, domain verification, load balancing, and other features through different record types.
Record TypePurposeExample
ADomain → IPv4 addressexample.com → 93.184.216.34
AAAADomain → IPv6 addressexample.com → 2606:2800:220:1:...
CNAMEDomain → another domain (alias)www.example.com → example.com
MXSpecifies mail serverexample.com → mail.example.com
TXTStores text informationSPF verification, domain ownership verification
NSSpecifies authoritative name serverexample.com → ns1.example.com

DNS Configuration in Real Scenarios

  • Deploying a website: Add an A record pointing to the server IP, or CNAME pointing to a CDN domain
  • Configuring email: Add MX records pointing to the mail server, TXT records for SPF/DKIM anti-spam
  • Verifying domain ownership: Cloud providers require you to add specific TXT records to prove you own the domain
  • Load balancing: Configure multiple A records for the same domain, DNS round-robin distributes traffic

3. HTTPS and TLS: Putting "Body Armor" on Your Data

HTTP protocol transmits data in plain text — like sending a postcard where the mailman (man-in-the-middle) can read the contents at will. HTTPS adds a layer of TLS (Transport Layer Security) encryption on top of HTTP, equivalent to putting the postcard in a sealed envelope.

The TLS handshake is the critical step for establishing a secure connection. It completes identity verification and key negotiation before正式 transmitting data.

🤝 TLS Handshake Demo

💻
Client (browser)
Client Hello
Send supported TLS versions, cipher suites, and random number
Server Hello
Choose TLS version, cipher suite, and server random number
Certificate
Server sends its digital certificate with public key
Key Exchange
Both sides negotiate and generate a session key
Finished
Both sides confirm the handshake and start encrypted communication
🖥️
Server

Core Steps of TLS 1.3 Handshake

  1. Client Hello: The client sends a list of supported encryption algorithms and a random number
  2. Server Hello: The server selects an encryption algorithm, returns the digital certificate and a random number
  3. Certificate Verification: The client verifies whether the server's certificate is trustworthy (checks CA signature, validity period, domain match)
  4. Key Exchange: Both parties negotiate a shared key through the ECDHE algorithm (the key itself is not transmitted over the network)
  5. Encrypted Communication: All subsequent data is encrypted using the negotiated symmetric key
FeatureTLS 1.2TLS 1.3
Handshake round trips2-RTT1-RTT (first time) / 0-RTT (resumption)
Key exchangeRSA or ECDHEECDHE only (forward secrecy)
Cipher suitesSupports more legacy algorithmsOnly secure algorithms retained
PerformanceSlowerFaster

4. Certificate Trust Chain: Why Should You Trust This Website?

The most critical step in the TLS handshake is "certificate verification." How does the browser determine whether a website's certificate is genuine and not forged by an attacker? The answer is the certificate trust chain — a system of endorsements at every level.

🔗 Certificate Trust Chain

Click each certificate layer to inspect its details and role in the trust chain.

🏛️
Root Certificate (Root CA)
Starting point of trust
issues
🏢
Intermediate Certificate (Intermediate CA)
Bridge of trust
issues
🌐
Server Certificate
Website identity card
🏛️Root Certificate (Root CA)
IssuerDigiCert Global Root G2 (self-signed)
Validity25 years (2013 - 2038)
Key lengthRSA 2048-bit
StorageOS/browser built-in trust store
ScaleAbout 150 trusted root certificates globally
The root certificate is the anchor of the whole trust chain. It is self-signed by a root certificate authority and preinstalled in operating systems and browsers. Only a small number of root CAs exist globally, protected by strict audits and physical security. Root CA private keys are usually stored offline in hardware security modules.
🔍 Browser Verification Flow
1Browser receives the server certificate and reads issuer information.
2It finds the intermediate certificate and verifies the server certificate signature with the intermediate CA public key.
3It then verifies the intermediate certificate signature with the root CA public key.
4It confirms the root certificate exists in the local trust store, so the whole chain is valid.

Three-Layer Structure of the Certificate Trust Chain

  1. Root Certificate (Root CA): Issued by trusted certificate authorities, pre-installed in operating systems and browsers. This is the "anchor" of trust.
  2. Intermediate Certificate (Intermediate CA): Issued by the root CA, used to issue end-entity certificates. Root CAs don't directly issue website certificates for security isolation.
  3. End-entity Certificate (Leaf Certificate): The certificate your website actually uses, issued by the intermediate CA, containing the domain name, public key, validity period, and other information.
Certificate TypeVerification LevelIssuance SpeedUse Case
DV (Domain Validation)Only verifies domain ownershipMinutesPersonal websites, blogs
OV (Organization Validation)Verifies organizational identityDaysCorporate websites
EV (Extended Validation)Strict identity verificationWeeksBanks, financial institutions
Wildcard CertificateCovers all subdomainsVaries by typeMulti-subdomain scenarios

5. HTTP vs HTTPS: Why Encryption Is the Baseline

In 2024, over 95% of global web traffic was transmitted via HTTPS. Chrome marks HTTP websites with a "Not Secure" warning, and search engines lower the ranking of HTTP websites. HTTPS is no longer an "optional extra" — it's the baseline requirement for the modern web.

🔐 HTTP vs HTTPS Data Transfer

💻
Browser
Original data
password=MySecret123&user=zhangsan
🔓 Plaintext transfer
🕵️
A man-in-the-middle can eavesdrop
🖥️
Server
ItemHTTPHTTPS
Port80443
Data encryptionNone (plaintext)TLS symmetric encryption
Identity verificationNoneCA certificate verifies server identity
Data integrityNo guaranteeMAC check prevents tampering
SEO impactSearch engines may rank it lowerPreferred by search engines
Performance costNo extra overheadTLS handshake adds about 1-2 RTT
DimensionHTTPHTTPS
Data transmissionPlain text, can be eavesdroppedEncrypted, cannot be eavesdropped
Identity verificationNone, cannot confirm server identityYes, server verified through certificates
Data integrityNo protection, can be tampered withProtected, tampering will be detected
Port80443
SEO impactLower search rankingSearch ranking boost
Browser displayShows "Not Secure" warningShows lock icon

Getting Free HTTPS Certificates

Let's Encrypt is a free, automated certificate authority that enables any website to enable HTTPS at zero cost. Combined with the Certbot tool, you can apply for and auto-renew certificates with a single command. Most cloud platforms and CDN providers also offer free SSL certificates.


Summary

Domain names, DNS, and HTTPS are the three pillars of internet infrastructure. DNS enables us to access websites using human-readable names, and HTTPS ensures the communication process is secure and trustworthy.

Key takeaways from this chapter:

  1. DNS is a hierarchical system: Root → Top-level domain → Authoritative, queried level by level, accelerated by caching
  2. Record types have different purposes: A records point to IPs, CNAME creates aliases, MX manages email, TXT handles verification
  3. TLS handshake establishes trust: Certificate verification + key negotiation, TLS 1.3 requires only 1-RTT
  4. Certificate trust chain: Root CA → Intermediate CA → Leaf certificate, endorsed at every level
  5. HTTPS is the baseline: Free certificates (Let's Encrypt) make encryption zero-barrier

Further Reading