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!
Top comments (0)