What Happens When You Type a URL
A classic interview question that ties every layer together. Typing https://prepverse.vercel.app/docs and pressing Enter does roughly the following.
1. Parse and check caches
The browser parses the URL (scheme, host, path), checks the HSTS list and its caches, and decides whether a cached copy can be used.
2. DNS resolution
The name is resolved to an IP address using the browser cache, OS cache, and then a recursive resolver, which queries root, TLD and authoritative servers if needed.
3. TCP connection
A three-way handshake (SYN, SYN+ACK, ACK) to port 443. With HTTP/3 a QUIC handshake over UDP is used instead.
4. TLS handshake
Agree on a cipher, verify the server certificate chain against trusted CAs, and derive session keys.
5. HTTP request
GET /docs HTTP/2
Host: prepverse.vercel.app
The request may pass through a CDN edge, a load balancer and a reverse proxy before reaching the application.
6. Response
The server returns a status code, headers and a body (HTML). The response may be cached by the CDN or browser according to Cache-Control.
7. Rendering
The browser parses HTML to build the DOM, fetches CSS, JavaScript, images and fonts (more requests, often multiplexed), builds the render tree, performs layout and paint, and runs JavaScript.
Layer by layer
| Step | Layer / protocol |
|---|---|
| Name lookup | Application: DNS (UDP/TCP 53) |
| Reliable connection | Transport: TCP / QUIC |
| Next hop MAC | Link: ARP |
| Routing across networks | Network: IP, BGP, OSPF |
| Encryption | TLS |
| Page request | Application: HTTP |
When answering, mention caching at every stage (browser, OS, DNS, CDN) and where failures show up (DNS failure, connection timeout, TLS error, 5xx).