After establishing a TCP (and possibly TLS) connection, the browser needs to ask the server for a specific resource. Without a structured request format, servers wouldn’t understand what the client wants.
An HTTP request is a structured message from client to server containing: method (GET, POST, etc.), target URL path, headers (cookies, user-agent), and optional body (for POST/PUT).
A typical HTTP request looks like:
GET / HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0
Cookie: session=abc123
- Request Line: Method + path + HTTP version
- Headers: Key-value pairs (Host, User-Agent, Cookie, etc.)
- Body: Optional data (for POST requests with form data/JSON)
The server reads this and determines what to return.
- Methods: GET (fetch), POST (submit), PUT (update), DELETE, etc.
- Headers provide metadata (cookies, auth, content-type)
- Body present only for methods that send data (POST, PUT)
- HTTP/1.1 requires Host header (virtual hosting)
- Built from: TCP Handshake — TCP connection must exist first
- Built from: TLS Handshake — for HTTPS, TLS wraps HTTP
- Builds into: HTTP Response — server replies to request
- Related: HTTP Headers — headers are part of the request
- Related: HTTP Methods — GET, POST, PUT, DELETE
- GET requests shouldn’t have a body (though some servers accept it)
- Large headers can cause issues (proxy limits)
- Missing Host header fails in HTTP/1.1
- Request smuggling possible with malformed headers