How HTTP works
Follow a page request from your browser to the server and back.
The request–response cycle
- (Browser to DNS resolver)
- (DNS resolver to browser)
- (Browser and web server)
- (Browser to web server)
- (Web server to browser)
- (Browser to web server)
- (Web server to browser)
What happens when you enter a URL?
-
Read the address
The browser reads
https://example.org/index.htmlas three parts.httpsis the scheme,example.orgis the host, and/index.htmlis the path. [8] -
Look up the host
If the browser has no usable cached address, it asks the Domain Name System (DNS) for the host’s IP address. [24]
-
Open a secure connection
In this HTTP/1.1 example, the browser opens a TCP connection, typically to port 443 for HTTPS. It then uses Transport Layer Security (TLS) to verify the server’s identity and set up encryption. [8], [25]
-
Ask for the page
The browser sends
GET /index.html. TheHostheader names the site andAccepttells the server which formats the browser can use. [8] -
Read the response
The server sends a status code, headers, and usually a body. Here,
200 OKreports success andContent-Type: text/htmlidentifies the body as HTML. [8] -
Load styles and images
The browser reads the HTML and finds links to files such as stylesheets and images. It requests any files it cannot reuse from its cache, then uses those responses to display the page. [8], [10]
Look inside an HTTP/1.1 exchange
GET /index.html HTTP/1.1
Host: example.org
Accept: text/html
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Connection: close
<!doctype html>
<html lang="en">…</html>
What HTTPS adds
TLS encrypts the messages and detects changes while they travel. The browser also checks the server’s certificate to verify that it covers the domain in the address bar. That protects a password on its way to the site. You still have to decide whether to trust the site itself. [8], [25]
HTTP/2 and HTTP/3 keep the same basic requests and responses while changing how they travel. HTTP/3 uses the QUIC transport protocol. As of November 2026, HTTP/3 is the latest standardized version. The draft titled HTTP/4 is an experimental proposal. [26], [27]
Reading the response status
| Code | Meaning | Example |
|---|---|---|
200
|
OK | The server returns the requested page. |
301
|
Moved Permanently | The resource has moved to a new URL. |
304
|
Not Modified | A conditional request confirms the browser can reuse its cached copy. |
403
|
Forbidden | The server refuses to fulfill the request. |
404
|
Not Found | The server cannot find the resource or will not reveal it. |
500
|
Internal Server Error | An unexpected error stopped the server from completing the request. |
Status definitions follow HTTP Semantics. [8]