From Address Bar to Pixels: Tracing a Secure Page Load
System DesignModel answerLast updated
Describe the full journey of a secure page request, from the browser's first lookups through DNS, connection setup, edge and backend handling, to the final rendering of the page.
A user types https://www.example-shop.com into a browser and presses Enter. A few hundred milliseconds later, a fully rendered page is on screen.
Walk through everything that happens in between. Your answer should cover:
- What the browser does before touching the network
- How the hostname is turned into an IP address
- How a secure connection is established
- How the request and response are exchanged
- What sits between the user and the application code (edge networks, load balancers, gateways)
- What the backend does to produce the response
- How the browser turns the response into pixels and loads the remaining resources
Start with a short outline, then go stage by stage. Where it is relevant, mention where latency is spent and where caching helps. Be ready to go deeper on any stage.
Hints
Hint 1
Begin with a one-line outline of the whole pipeline so the structure is clear before you add detail. Then keep the order of dependencies right: you cannot start TLS before a transport connection exists, and you cannot connect without an IP address.
Hint 2
For every stage, ask what is cached and what it costs in round trips. Think about DNS caches and TTLs, reused connections, TLS session resumption, the HTTP cache, and CDN edge caches.
Hint 3
Do not stop when the HTML arrives. Cover how the browser builds the DOM and CSSOM, why CSS and synchronous scripts block rendering, the layout, paint and composite steps, and the subresource requests that follow.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Approach
The interviewer is looking for a correct end-to-end structure, precision about which step depends on which, and the ability to go deeper on request. I would open with a short outline and then take each stage in turn, noting latency and caching as I go.
Outline: URL parsing and local checks → DNS → transport connection (TCP or QUIC) → TLS → HTTP request → edge (CDN, load balancer, gateway) → backend → response → rendering → subresources.
1. Browser: parse and check local state
- The browser decides whether the input is a URL or a search term. Here it is a URL, which yields scheme
https, hostwww.example-shop.com, default port 443 and path/. - HSTS. If the domain is on the preload list or has a cached HSTS policy, the browser uses HTTPS directly and never makes an insecure first hop.
- Local caches before the network:
- The HTTP cache may hold a fresh copy, so no request is needed.
- A registered service worker may intercept the request.
- A warm HTTP/2 or HTTP/3 connection to the host may be reused, which skips DNS, transport and TLS setup.
2. DNS resolution
The goal is to map the hostname to an IP address. Lookups proceed through caches in order: browser, OS (including the hosts file), then the configured recursive resolver (ISP, or a public one, possibly over DNS-over-HTTPS).
On a miss, the recursive resolver walks the hierarchy: root servers refer it to the .com TLD servers, which refer it to the site's authoritative nameservers, which return the answer.
Large sites often answer with a CNAME to a CDN hostname, and the CDN's DNS then returns a nearby edge IP, based on resolver location or EDNS Client Subnet. Others use anycast, where one IP is announced from many locations and BGP routes the user to the nearest one. Results are cached for the record's TTL. The browser may query A and AAAA records and race IPv4 against IPv6 (Happy Eyeballs).
Cost: zero on a cache hit, otherwise from a few ms to a few hundred ms on a cold lookup.
3. Transport connection
- TCP: a three-way handshake (SYN, SYN-ACK, ACK) costs one round trip. TCP then provides reliable, ordered delivery with flow and congestion control, starting in slow start.
- QUIC / HTTP/3: if the server advertised support (Alt-Svc or an HTTPS DNS record), the browser may use QUIC over UDP. It combines transport and crypto setup in one round trip (zero on resumption) and avoids TCP-level head-of-line blocking.
4. TLS handshake
With TLS 1.3 this takes one additional round trip over TCP:
- The ClientHello carries supported cipher suites, an ephemeral key share, SNI (so the server can pick the right certificate) and ALPN (to negotiate
h2orhttp/1.1). - The server replies with its key share, its certificate chain, a signature proving key possession, and Finished.
- The client validates that the chain reaches a trusted root, that the hostname matches the certificate's SAN, that the dates are valid, and revocation status (for example via OCSP stapling).
- Both sides derive symmetric keys from the ephemeral exchange, giving forward secrecy. Traffic is then protected with an AEAD cipher such as AES-GCM or ChaCha20-Poly1305.
- Resumption with tickets or PSKs saves a round trip. 0-RTT data is possible but replayable, so it should be limited to idempotent requests.
5. The HTTP request
The browser sends something like GET / with :authority, user-agent, accept, accept-encoding: gzip, br and cookies. HTTP/2 multiplexes many streams over one connection and compresses headers (HPACK). HTTP/3 does the same over QUIC with QPACK. Cookies carry session state.
6. The edge
Before reaching application code the request typically crosses several layers:
- CDN edge: terminates TLS near the user, applies WAF and DDoS protection, serves cached static assets, and forwards dynamic or personalized requests to the origin, usually over warm persistent connections.
- Load balancers: L4 balancers route by IP and port. L7 balancers route by host, path and headers, run health checks, and may re-encrypt to backends.
- Gateway / reverse proxy: rate limiting, authentication and routing to the right service.
7. Backend handling
- A frontend service typically fans out in parallel to many backends such as session, catalog, pricing, recommendations and cart. Each is guarded by timeouts.
- Backends consult caches (Redis, Memcached) before databases.
- Graceful degradation: if a non-critical dependency such as recommendations times out, the page is served without it rather than failing.
- The server renders HTML (server-side rendering helps first paint and SEO) and sets status,
content-type,cache-control,set-cookieand compression. It often streams the response so the browser can start parsing early. - The response flows back through the load balancer and CDN, which may cache it if allowed.
8. Rendering: the critical rendering path
- HTML to DOM. Parsing is incremental. A preload scanner looks ahead and starts fetching CSS, JS and images early.
- CSS to CSSOM. CSS is render-blocking.
- JavaScript. A plain script blocks the parser while it downloads and runs.
asyncruns as soon as it arrives.deferruns in order after parsing. - Render tree from DOM plus CSSOM, containing visible nodes only.
- Layout computes geometry.
- Paint rasterizes boxes into layers.
- Composite combines layers on the GPU into frames.
- Subresources such as images, fonts, API calls and analytics load afterwards, often from other origins that need their own DNS and connection setup.
Trade-offs and performance levers
- Fewer round trips: connection reuse, TLS 1.3, QUIC, resumption,
preconnectanddns-prefetch. - Less data: compression, image optimization, caching headers, CDN offload.
- Faster first paint: inline critical CSS,
deferscripts, streaming SSR. - Resilience: timeouts, retries with budgets, fallbacks.
Common mistakes
- Putting TLS before TCP, or forgetting that SNI is sent in the ClientHello, before the certificate is seen.
- Saying DNS always walks root to authoritative, ignoring the multiple cache layers.
- Treating the CDN as only a static file cache, and forgetting TLS termination and routing.
- Ending at "the server returns HTML" and skipping rendering and subresource loading.
- Claiming HTTP/3 uses TCP, or that 0-RTT is always safe.
- Giving a flat list of facts with no mention of latency, caching or failure handling.