Ever wondered what’s happening behind the scenes when you type something like example.com/phone
into your browser and hit Enter? Let’s break it down:
🔹 Step 1: Entering the URL
Bob types a URL into the browser. A URL typically has four parts:
-
Scheme:
http://
→ tells the browser to use HTTP protocol -
Domain:
example.com
→ identifies the server -
Path:
/product/electric
→ specifies the resource location -
Resource:
phone
→ the exact item Bob wants to view
🔹 Step 2: DNS Lookup
The browser needs the IP address of the domain. It searches through:
- Browser cache
- OS cache
- Local network cache
- ISP cache
If the IP address isn't found, a recursive DNS lookup is triggered (we’ll dive deeper into this in another post).
🔹 Step 3: Establishing a TCP Connection
With the IP address in hand, the browser sets up a TCP connection to the server.
🔹 Step 4: Sending the HTTP Request
The browser sends a structured HTTP request asking for the /phone
resource under the domain example.com
.
🔹 Step 5: Receiving the HTTP Response
The server processes the request and sends back an HTTP response.
If successful (status code 200 OK), it includes the requested HTML content like:
Hello world
🔹 Step 6: Browser Renders the Page
Finally, the browser takes the HTML and renders the page so Bob can see and interact with it.
🔍 Key takeaway:
Typing a URL triggers a chain of networking and server events — from DNS lookups to TCP handshakes to rendering web pages — all in a blink of an eye!