Wirebook › Lesson 1 of 18
What happens when you open a web page?
You type an address, press Enter, and about a tenth of a second later a page appears. In that blink, your request crosses cities, gets translated, locked in a box, unlocked, answered and painted on screen. Let's slow it right down.
The journey, in plain words
- Find the address. Computers don't understand names like
learn.oddlathe.com; they need a number (an IP address). Your device asks a DNS resolver, a kind of phone book. The answer is usually cached for minutes or hours, so later visits skip this step. - Shake hands. Your browser opens a connection and does a TLS handshake: the server proves who it is with a certificate, and both sides agree on fresh secret keys. That's the padlock. From here on, everything is encrypted.
- Ask politely. The browser sends an HTTP request: "GET / please, I speak English, I accept HTML". It's just a few lines of text.
- Through the tunnel. This site's server never opens its doors to the internet. Instead it keeps an outgoing connection to Cloudflare, called a tunnel, and requests are passed back down it. That means no open ports for strangers to knock on.
- Answer. A tiny Python program reads a file and replies "200 OK" with the page. It took the server well under a millisecond.
- Paint. Your browser reads the HTML, spots the stylesheet and script it needs, fetches those too, works out where every box goes (layout) and colours in the pixels (paint).
Most of the waiting is distance, not thinking. Light in fibre travels about 200 km every millisecond, so a round trip from Edinburgh to London and back costs about 5 ms before any computer does anything at all. That's why big sites copy their pages to servers all over the world.