How the web actually works
ویب اصل میں کیسے کام کرتی ہے
40 min read
Three ways to see it
The web is not magic. It is a conversation between two computers, your browser (the client) and a remote machine (the server), spoken in a protocol called HTTP. Every page on Daraz, every Easypaisa receipt screen, every NADRA Pak-ID portal screen, every Foodpanda order tracker, is just a series of HTTP requests and responses. Once you see this clearly, the entire industry of web development stops being mysterious. A developer's job is to design what the client asks for, what the server returns, and what happens in between.
Way one, the address translation. When you type fbr.gov.pk, your computer does not know where that machine lives. It first asks a DNS resolver, often your PTCL or Nayatel router's default, for the IP address. DNS is the web's phonebook. The resolver may ask higher resolvers until it returns something like 119.160.111.34. Now your browser knows where to send its question. DNS failures are why a site can be 'down for you but working for everyone else', a common Pakistani complaint when PTCL's DNS lags. Switch to 1.1.1.1 or 8.8.8.8 and the site often returns instantly.
Way two, the request and response. With the IP address in hand, your browser opens a TCP connection to the server on port 443 (HTTPS) and sends a request that looks like: GET / HTTP/1.1, Host: fbr.gov.pk, plus a stack of headers (User-Agent, Accept-Language, Cookie, and so on). The server answers with a status code (200 OK, 404 Not Found, 500 Server Error, 301 Redirect) and a body (HTML, JSON, an image, anything). The browser parses the HTML, sees references to CSS files, JavaScript files, images, and fonts, and makes a fresh request for each one. A modern page like daraz.pk fires off forty to a hundred such requests in the first few seconds.
Quick check
Quick check: what makes modern AI different from a rule-based program?
The why-tree
Why-tree level one: why a client-server model at all? Because the data and the logic must live somewhere stable. If FBR put every tax return on every citizen's laptop, there would be no single truth. The server is the source of truth. The client is a window. This separation is what allows millions of users to see the same NADRA record at the same time.
Try this with Claude
AI-edge prompt to try with Claude: 'Explain a CORS error to me like I am an SBP analyst who just got blocked calling our partner bank's API. Use a banking analogy, then give me the exact three response headers the partner must send back, and the exact OPTIONS preflight request my client will issue first.' Read the answer twice. CORS confuses everyone the first time.
Sources
Sources and further reading. MDN, 'How the Web works' (developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/How_the_Web_works). web.dev, 'Performance fundamentals'. RFC 9110, HTTP Semantics (rfc-editor.org). Cloudflare Learning Center, 'What is DNS'. Let's Encrypt documentation on certificates. SBP Open Banking draft framework, 2024. PECA 2016 sections on data interception. Chrome DevTools documentation on the Network panel.