General
How a Web Request Works: From URL to Page Render
Explore the step-by-step journey of a web request, covering DNS lookups, TCP handshakes, server-side processing, and browser rendering.
June 2026 · 4 min read · 3 views · 0 hearts
Advertisement
Ever wonder what actually happens in the split second between hitting "Enter" on your browser and seeing a webpage appear? It feels like magic, but it’s actually a high-speed relay race involving several different computers, protocols, and layers of architecture across the globe.
Here is the step-by-step journey of a web request.
1. The Address Book: DNS Lookup
Computers don't actually understand names like google.com or pythonskillset.com. They communicate using IP addresses—strings of numbers like 192.0.2.1.
When you type a URL into your browser, your computer first needs to translate that human-readable name into a machine-readable IP address. This is the job of the Domain Name System (DNS).
- Browser Cache: First, the browser checks if it has visited the site recently. If it has, it uses the cached IP.
- OS Cache: If not, it asks your operating system.
- Resolver (ISP): If still unknown, the request goes to your Internet Service Provider’s DNS resolver.
- Root & TLD Servers: If the ISP doesn't know, it climbs a hierarchy of servers (Root $\rightarrow$ Top-Level Domain $\rightarrow$ Authoritative Name Server) until it finds the exact IP address mapped to that domain.
2. The Handshake: Establishing a Connection
Now that your browser knows the server's IP address, it needs to open a connection. This happens via TCP (Transmission Control Protocol).
Think of this as a formal introduction called the Three-Way Handshake: 1. SYN: Your computer sends a "Synchronize" packet to the server. 2. SYN-ACK: The server replies with a "Synchronize-Acknowledgement" packet. 3. ACK: Your computer sends an "Acknowledgement" back.
If the website uses HTTPS (which almost all do), an additional TLS/SSL Handshake occurs. This involves exchanging digital certificates and encryption keys to ensure that no one can "eavesdrop" on your data while it travels across the wire.
3. The Ask: The HTTP Request
With the connection secure, your browser finally sends an HTTP Request. This is essentially a digital note that says: "Hello server, I would like to see the content of the page located at /index.html."
This request contains several pieces of metadata:
* The Method: Usually GET (fetching data) or POST (sending data).
* Headers: Information about which browser you are using (User-Agent), what languages you prefer, and any cookies you already have for that site.
4. The Brains: Server-Side Processing
The server receives the request and decides how to handle it. Depending on the site, one of two things happens:
- Static Content: If it's a simple HTML file, the server simply grabs the file from the disk and sends it back.
- Dynamic Content: If it's a modern app (built with Python/Django, Node.js, or PHP), the server runs code. It might query a database to find your user profile, calculate a shopping cart total, or generate a personalized news feed.
Once the processing is complete, the server wraps the result in an HTTP Response, which includes a status code (like 200 OK for success or 404 Not Found if the page doesn't exist).
5. The Construction: Rendering the Page
The server sends the data back to your browser in pieces (packets). Your browser then begins the "Critical Rendering Path" to turn code into a visual experience:
- Parsing HTML: The browser reads the HTML to build the DOM (Document Object Model)—the skeleton of the page.
- Fetching Assets: While reading the HTML, the browser finds links to CSS (styling), JavaScript (interactivity), and images. It sends separate requests to download these items.
- CSSOM: The browser parses the CSS to determine how the elements should look (colors, fonts, layout).
- JavaScript Execution: The browser runs the JS code to make the page interactive (e.g., dropdown menus or live updates).
Summary: The Big Picture
In a matter of milliseconds, your request has traveled from your keyboard, through your router, across underwater fiber-optic cables, into a data center, through a web server, and back again.
The next time a page loads instantly, remember: thousands of calculations and several "handshakes" just happened across the planet to make that possible.
Advertisement
Comments
Questions, corrections, and tips stay visible for everyone reading this page.
Join the discussion
No comments yet
Be the first to leave a note — it helps the next reader.