What Happens When You Request a Web Page

Say you want to go to example.com. What happens under the hood after you type the page’s address into your browser?

  1. DNS lookup:
    1. DNS caches are checked: browser cache, operating system cache
    2. Local computer’s hosts file and the router’s cache are checked
    3. Local computer’s resolver config is checked for the address of the recursive DNS server (ex. ISP’s DNS server).  That server’s cache and records are then checked for example.com, usually via UDP port 53.

      Image credit: ccnahub.com
    4. Root DNS servers for .com are checked
    5. Top Level DNS servers are checked
    6. Authoritative DNS servers are checked
    7. If the record is found, the result is cached by the recursive DNS servers and your local system
  2. Browser sends HTTP request to the IP returned by the DNS server:
    1. Makes system call to the operating system’s kernel to create a TCP internet socket (fd = socket(AF_INET, SOCK_STREAM)
    2. Connects to a port (ex. 80) on an IP (from DNS) (fd,
    3. Makes a request (write (fd, "GET /index.html HTTP/1.1)
    4. Reads the response (index.file=read(fd ...))
  3. Server responds and sends back the requested HTML file
  4. Browser renders HTML
  5. Browser sends additional requests for objects embedded in the HTML file (ex. CSS files, images, JavaScript, etc.)

I used the following resources in researching this:

Jeff Smith’s DNS Explained tutorial
Steven Bradley’s What Happens When Your Browser Requests a Web Page
Julia Evan’s Bite Size Networking wizard zine

Hope this helps anyone curious for a deeper level understanding of this!

Update: A week after posting this, I happened across a page dedicated to explaining this process in exhaustive detail, right down to what happens when you press the first key!  (on a physical or virtual keyboard)

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s