What happens after you press Enter
You type example.com into your browser and press Enter. Less than a second later, a page appears. Behind that page, your browser and a web server had a short, polite conversation. The rules for that conversation are called HTTP.
Request first, response second
HTTP (Hypertext Transfer Protocol) is the protocol browsers use to ask web servers for pages, images and data. It works by request and response: the client (your browser) initiates a request, and the server answers. Plain HTTP uses TCP port 80. TCP delivers an ordered byte stream while the connection works; a broken connection can still end in an error. A TCP acknowledgement does not prove the application processed the request.
For this first-visit HTTP/1.1 example, assume there is no cached address or existing connection. DNS (Domain Name System) resolves the name, then TCP opens a connection to port 80. A cached DNS answer or reusable connection can skip those setup steps. HTTP/3 instead uses QUIC over UDP; the request and response meanings remain familiar.
Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- Your laptop: IP 192.168.1.20
- Web server: IP 203.0.113.10
- 1. 1. DNS lookup. The laptop asks: what is the IP address of example.com? The answer is 203.0.113.10.
- 2. 2. TCP handshake. SYN, SYN-ACK and ACK to port 80 open a reliable connection.
- 3. 3. HTTP request. The browser asks for the page with a GET request.
- 4. 4. HTTP response. The server sends back a status code, some headers and the page itself.
The request and the response
HTTP/1.1 uses text for its start line and headers; the body can contain binary data, such as an image. HTTP/2 and HTTP/3 represent message information using binary frames. The request names a method (what to do) and a path (which resource). The response starts with a status code, a three-digit number that shows the result. Both carry headers: extra lines of information such as the type of content or its size.
Device key: Browser (laptop)
Arrows run from each message's sender to its receiver. Rows show message order, not separate cables or elapsed time to scale. Port numbers identify services or conversations, not physical switch sockets.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- Browser: 192.168.1.20:51544
- Web server: 203.0.113.10:80
HTTP/1.1 normally permits connection reuse. These are logical application messages; packets may be split or combined, and connections can be closed.
Methods: what the browser asks for
| Method | What it asks the server to do | Everyday example |
|---|---|---|
| GET | Send me this resource | Opening a page |
| POST | Take this data and process it | Sending a login or contact form |
| PUT | Store this data at this path | Uploading or replacing a file through an API |
| DELETE | Remove this resource | Deleting an item through an API |
| HEAD | Send only the headers, not the body | Checking if a page exists |
Status codes: how the server answers
The first digit tells you the kind of answer:
| Class | Meaning | Common codes |
|---|---|---|
| 2xx | Success | 200 OK |
| 3xx | Redirection or cache-related handling, depending on the code | 301 Moved Permanently, 302 Found |
| 4xx | A problem with the request (client error) | 401 Unauthorized, 403 Forbidden, 404 Not Found |
| 5xx | The server failed to handle a valid request | 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable |
An HTTP status proves that an HTTP-speaking endpoint replied, not that every part of the path is healthy. A reverse proxy (a service in front of the application) can return 502 while its connection to the application server is broken. A cached address can also mean no new DNS lookup occurred. Locate the responding endpoint before declaring DNS, routing or the origin server healthy.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
In Figure 2, the browser reaches the front-end service on port 80. The proxy then tries a separate connection to application port 8080. That connection fails, so the proxy generates 502 Bad Gateway. Check the proxy log and its backend route, firewall and application listener; repeating the browser DNS lookup will not repair that backend fault. Ports here identify application services, not switch interfaces.
Stateless and unencrypted by design
HTTP is stateless: the protocol does not require a request to belong to a remembered conversation. Applications can still store login sessions, carts and other state in databases or memory. A browser can carry a session identifier in a cookie with each request to that site.
Plain HTTP provides no transport encryption. An observer with access to the traffic can read or alter it. HTTPS adds protection; POST alone does not encrypt a password. A redirect only takes effect after the initial HTTP request has already crossed the network. Browsers may also upgrade directly to HTTPS through site security policies.
Learn more: HTTPS and TLS
Read the headers, then test the application
On macOS, Linux or Windows (type curl.exe in PowerShell), curl can show the response headers. The Windows command below forces HTTP/1.1 for comparison with the figure and limits the operation to 15 seconds. Use curl instead of curl.exe on Linux/macOS. The -I option sends HEAD, so no response body is transferred. A service can handle HEAD differently from GET.
curl.exe --http1.1 -I --max-time 15 http://example.comAsk only for the headers of the page.
HTTP/1.1 301 Moved Permanently Location: https://example.com/ Content-Type: text/html Content-Length: 162
This is a constructed redirect example, not a claim about the current response from example.com. What to look for: the first line is the status line. The 301 Moved Permanently code and the Location header show that the server is redirecting you to the HTTPS address. Content-Type and Content-Length describe the (short) body the server would send. You can also try the HTTP Headers tool to see the headers of any public site.
Try it: separate connection failure from an HTTP error
Use the public example.com demonstration site or an authorised lab server. Start with HEAD, then use the command below to make a GET request and display its response headers. -D - writes headers to the screen, -o NUL discards the body on Windows, and --max-time 15 prevents an indefinite wait. On Linux/macOS use -o /dev/null. These commands make requests but do not change your computer's network settings.
curl.exe --http1.1 -D - -o NUL --max-time 15 http://example.comSend GET and inspect the response headers without displaying the body.
Record the status and any Location header. curl does not follow a redirect by default. If DNS cannot resolve the name, there is no HTTP reply in this direct example. If the connection is refused, investigate the listener or a rejecting firewall. If a 404 arrives, check the hostname and resource path. Repeat after correcting the fault and compare the evidence. In a proxy-based network, the proxy may resolve names or generate its own reply.
Test yourself on HTTP
You click a link on a website and the browser shows "404 Not Found". What does this tell you?
You fill in a login form and click Sign in. Which method does the browser normally use to send the form?
In a direct first visit with no cached address, no existing connection and no proxy, DNS resolution fails. Can the browser start HTTP to that named server?
Technical references
RFC 9110: HTTP semantics; RFC 9114: HTTP/3; curl command reference.