Lesson 1: You hit Enter — who starts the conversation?
Lesson objectives:
- Name the two main actors in an HTTP exchange.
- Explain what a URL does.
- Identify the request and the response in a simple exchange.
Prerequisites: None | Next 2 >>
The web feels instant, but it is actually a short conversation
You type https://example.com into the browser, press Enter, and the page appears. But before anything shows up, two strangers have to agree on a language. One of them is the browser on your computer; the other is the server somewhere on the internet. The language they speak is HTTP.
HTTP is a client-server protocol (a protocol is just an agreed set of rules for a conversation): the browser (the client) starts by sending a request, and the server answers with a response 12. The address the browser uses is the URL. A URL is the address: it tells the browser which server to talk to and which page or file to ask for.
Here is the simplest version of what happens:
The point of this diagram is not every technical detail. It is the direction of the arrows: the browser always speaks first, and the server always replies.
Explanation
The browser is the client
The browser is the program that asks for things. When you press Enter, it looks at the URL, finds the server, and sends an HTTP request 1. It cannot read the page until the server sends it back.
The server is the responder
The server listens for requests. When it receives one, it decides what to send back. That answer is the HTTP response. The server might be one computer or many, but from the browser's point of view it is just "the server" 1.
The URL is the address
A URL like https://example.com/index.html has two jobs: it says which server to contact (example.com) and which resource to ask for (/index.html). The browser turns that URL into a request that the server understands.
A request and a response are a pair
Every HTTP exchange is one request followed by one response. If the response gets lost, the browser will usually ask again. There is no response without a request first 23.
Worked example (follow along)
Let's say you type https://example.com and press Enter.
- The browser reads the URL and decides: "I need to ask the server at example.com for the resource
/." - The browser sends an HTTP request that starts with:
- The server at example.com receives the request and sends back a response:
- The browser reads the response body and displays the page.
Your turn (faded example)
Fill in the blanks in this exchange:
- You type a URL into the browser.
- The browser sends an HTTP request to the server.
- The server sends back an HTTP response.
- The browser shows the page.
Summary + what's next
In this lesson you met the four pieces of every HTTP exchange: the browser (client), the server, the URL, and the request/response pair. Next, you will look inside the request itself and learn what the browser actually writes on the envelope.
Footnotes
-
MDN: Overview of HTTP — https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Overview ↩ ↩2 ↩3
-
RFC 9110: HTTP Semantics — https://www.rfc-editor.org/rfc/rfc9110.html ↩ ↩2
-
MDN: HTTP messages — https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Messages ↩