Web Fundamentals: How the Web Works
Clients, Servers, and the Internet
The web is a conversation between clients and servers. Your browser is the client. It sends requests asking for resources, and servers respond with the requested content, usually an HTML page, an image, or data in JSON format. Between them flow packets of information across a global network of routers and cables. The whole system is built on a stack of standards, the most visible being HTTP, the language of the request and response.
Addresses: URLs
Every resource on the web has a URL, which stands for Uniform Resource Locator. Take this example: https://example.com/blog/java. The scheme tells the browser which protocol to speak. The host is the server name. The path, starting with a slash, identifies the specific resource on that server. Optional parts like query strings carry extra parameters after a question mark.
https://example.com:8080/blog/java?page=2#comments
scheme host port path query fragmentThe port is optional and defaults to 80 for HTTP and 443 for HTTPS. The fragment points to a section inside the page.
DNS Resolves Names
Computers talk in IP addresses such as 142.250.190.78. Humans prefer names like example.com. The Domain Name System, or DNS, translates the friendly name into the numeric address. When you type a URL, the browser asks a resolver for the IP address, connects to that server, and then sends its request. DNS responses are cached by your browser and operating system, which is why repeat visits feel instant.
A Round Trip in Steps
- The browser asks DNS to resolve the hostname.
- The browser opens a connection to the server address.
- It sends an HTTP GET request for the page.
- The server locates or builds the resource.
- The server sends back a response with a status code and body.
After the browser receives the HTML, it parses the document, discovers linked CSS and scripts, and issues further requests to render the full page.
Key Points
- Clients request resources and servers respond over HTTP.
- A URL combines scheme, host, port, path, query, and fragment.
- DNS maps human-friendly hostnames to IP addresses.
- Loading one page can trigger many follow-up requests.