01·Concept·8 min

What happens when you click

Type an address, press Enter, and a page appears. Between those two moments, four things happen in order.

1. DNS: name to number

Computers route by IP address, not by name. Your device asks a DNS resolver "what is the address for shop.example.com?" and gets back a number. Answers are cached for a while, which is why a changed record takes time to be seen everywhere.

2. TLS: a private line

Before any page data moves, your browser and the server agree on encryption keys. The server proves who it is with a certificate signed by an authority your browser trusts. That handshake is the padlock; everything after it is unreadable to anyone in between.

3. The request and the server

Your browser sends a request: a method (GET to read, POST to send), a path, headers (cookies, language, device), and sometimes a body. A server reads it, maybe queries a database, and returns a response: a status code (200 ok, 404 not found, 500 server error), headers, and the page or data.

4. Rendering

The browser turns HTML into a page, then fetches what the page references: images, fonts, scripts. Each of those is another request through the same steps, which is why a page with fifty images feels slower than one with five.

Why it feels fast anyway

Static files are served from a CDN, servers spread around the world that keep copies close to visitors. Repeat visits use cached copies. And a good server answers in tens of milliseconds, so the round trip, not the work, is usually the cost.

Where DontCode fits

Every deploy is built into static files plus server code, published behind a CDN with an https certificate that is issued and renewed for you. Your job ends at the domain name; DNS records for a custom domain are the one thing you paste in yourself.

Go deeper

Check your understanding

  1. 1.What is the first thing that happens after you press Enter on a new address?

  2. 2.What does the certificate in a TLS handshake prove?

  3. 3.A response comes back with status 500. Who had the problem?

  4. 4.Why does a CDN make a site faster?