Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →
TOPIC 1 OF 5 · 3 MIN READ

What Happens When You Type a URL

What happens when you type a URL and press Enter is the most common opening question in backend interviews. The answer walks through DNS, TCP, TLS, the HTTP request, your server and the response, and shows the interviewer you understand the whole path a request takes.

What you will learn

  • Explain DNS resolution from the browser cache to the authoritative name server
  • Describe the TCP three-way handshake and the TLS handshake
  • Follow the request through a load balancer, reverse proxy and app server
  • Know where caching and CDNs cut the time

Key concepts

DNS

The Domain Name System turns a name like api.example.com into an IP address. The lookup goes browser cache → OS cache → recursive resolver → root → TLD (.com) → authoritative server. Answers are cached for their TTL.

TCP handshake

Before any data, client and server exchange SYN, SYN-ACK and ACK so both sides agree on sequence numbers. This costs one round trip. HTTP/3 uses QUIC over UDP and folds this into the TLS handshake.

TLS

TLS encrypts the connection. The server sends its certificate, the client checks it against trusted certificate authorities, and both sides agree on session keys. TLS 1.3 needs one round trip (zero on resumption).

Reverse proxy

A server such as Nginx, Envoy or a cloud load balancer that sits in front of your app. It terminates TLS, spreads traffic over app instances, compresses responses and can serve static files.

Step by step

1. Resolve the name

The browser parses the URL (scheme, host, port, path, query) and resolves the host to an IP through the DNS chain. A CDN often answers with the IP of the nearest edge server.

2. Open a secure connection

The browser opens a TCP connection to port 443 and runs the TLS handshake. Connections are kept alive and reused, so later requests skip this cost.

3. Send the HTTP request

The browser sends the method, path, headers (Host, Cookie, Accept, Authorization) and an optional body.

GET /api/orders?page=2 HTTP/1.1
Host: api.example.com
Accept: application/json
Authorization: Bearer eyJhbGciOi...
Cookie: sid=8f2c...

4. The server handles it

The load balancer picks a healthy instance. The app runs middleware (logging, auth, rate limit), routes to a handler, reads from a cache or database and builds a response.

  • Load balancer → app instance
  • Middleware → route handler
  • Cache → database
  • Serialize JSON → send

5. The browser uses the response

The response carries a status code, headers (Content-Type, Cache-Control, Set-Cookie) and a body. For a page, the browser parses HTML and fetches CSS, JS and images, often over the same connection.

Examples

Seeing every step with curl

# -v prints DNS, TCP, TLS and the raw headers
curl -v https://api.example.com/health

# timing of each phase
curl -o /dev/null -s -w "dns:%{time_namelookup} connect:%{time_connect} tls:%{time_appconnect} ttfb:%{time_starttransfer} total:%{time_total}\n" https://api.example.com/health

Practise it

Try these without looking back. If you can explain each one out loud, you are ready for this question.

  • Explain the full path of a request out loud in under two minutes.
  • Run the curl timing command on three sites and say which phase is slowest and why.
  • Explain what changes when the response is served from a CDN edge.
  • Explain why the second request to the same site is faster than the first.

Interview questions

What interviewers ask next on this topic. Answer out loud first, then open the model answer.

Where can DNS be cached?

In the browser, the operating system, the router and the recursive resolver (your ISP or 1.1.1.1 / 8.8.8.8). Each copy lives until its TTL expires, which is why a DNS change can take time to reach everyone.

What is TTFB and what makes it slow?

Time To First Byte is the time from sending the request to receiving the first byte of the response. It includes network round trips and server work, so slow queries, cold starts, no connection reuse and a far-away server all raise it.

Why does HTTP/3 use UDP?

HTTP/3 runs on QUIC, which is built on UDP. QUIC handles reliability per stream, so one lost packet no longer blocks every other request on the connection (TCP head-of-line blocking), and it combines the transport and TLS handshakes to save round trips.

Summary

DNS turns the name into an IP, TCP and TLS set up a secure connection, the request passes a load balancer and middleware to your handler, and the response comes back with a status, headers and body. Caching and connection reuse at each layer are what make it fast.

Stuck on this one? Talk to Sumit.

Keys: F focus mode · ← → previous / next topic · Esc leave focus