HTTP
The protocol powering the web. A request-response model where clients ask for resources and servers respond. Stateless by design.
What is HTTP?
In short
HTTP (HyperText Transfer Protocol) is the request-response protocol that web browsers, mobile apps, and servers use to exchange data over the internet. A client sends a request with a method like GET or POST to a URL, and the server returns a status code and a body; each request is stateless, meaning the server keeps no memory of previous requests on its own.
What HTTP actually is
HTTP is the set of rules that lets a client and a server talk over a network. When you type systemdesign.academy into a browser, the browser opens a connection to the server and sends an HTTP request. The server reads it, does some work, and sends back an HTTP response. That round trip is the whole protocol in one sentence.
Every request carries a method, a path, headers, and an optional body. The method says what you want to do: GET to read a resource, POST to create one, PUT to replace, PATCH to update part of it, DELETE to remove it. The path points at the resource, like /api/lessons/http. Headers carry metadata such as Content-Type, Authorization, and Cookie.
Every response carries a status code and usually a body. Codes are grouped: 2xx means success (200 OK, 201 Created), 3xx means redirect (301, 304 Not Modified), 4xx means the client made a mistake (404 Not Found, 401 Unauthorized, 429 Too Many Requests), and 5xx means the server failed (500 Internal Server Error, 503 Service Unavailable).
How it works under the hood
HTTP runs on top of a transport layer. In HTTP/1.1 and HTTP/2 that transport is TCP, usually wrapped in TLS for HTTPS on port 443. HTTP/3 changed this by running over QUIC, which is built on UDP, to cut the handshake time and avoid head-of-line blocking when one packet is lost.
The defining trait of HTTP is that it is stateless. The server does not remember that you logged in two requests ago. To carry identity across requests, the client resends proof every time, normally a session cookie or a bearer token in the Authorization header. State lives in the database or a cache like Redis, not in the protocol.
Performance has improved version by version. HTTP/1.1 added persistent connections so a single TCP connection could serve many requests, but they still went one at a time per connection. HTTP/2 added multiplexing, so many requests share one connection in parallel, plus header compression. HTTP/3 over QUIC removes the TCP head-of-line blocking problem entirely and resumes connections faster on flaky mobile networks.
When to use it and the trade-offs
HTTP is the default for almost any client-to-server communication on the web: loading pages, calling REST and GraphQL APIs, fetching images from a CDN. It is text-based and human-readable, every language has a client, and proxies, load balancers, and caches all understand it, which makes it easy to operate and debug.
The trade-offs come from the request-response model. HTTP is pull-based: the client has to ask before the server can send anything. That makes it a poor fit for real-time push, like live chat or stock tickers, where you want WebSockets or Server-Sent Events instead. The statelessness that makes it scalable also means you pay to reattach identity and context on every call.
Caching is where HTTP shines and where teams get the most wins. Response headers like Cache-Control, ETag, and Last-Modified let browsers and CDNs reuse responses without hitting your origin. A 304 Not Modified response sends no body at all, which is why a well-tuned site can serve most traffic from cache and only touch the database for the parts that actually changed.
A concrete example
Open developer tools and load any page, and you watch HTTP at work. The browser sends GET / with an Accept header, the server returns 200 OK with HTML, and the browser then fires dozens more GET requests for CSS, JavaScript, fonts, and images, many of them answered straight from cache with a 304.
When you log in, the browser sends POST /login with your credentials in the body. The server validates them and replies with Set-Cookie. From then on every request automatically includes that cookie in a Cookie header, which is how the stateless server recognizes you. If the cookie expires, the next protected request comes back 401 and you are bounced to the login page.
Cloudflare and Fastly sit in front of millions of sites and answer HTTP requests at the edge, returning cached responses in single-digit milliseconds and only forwarding a miss to the origin. That entire content delivery layer is built on reading HTTP methods, paths, and cache headers.
Where it is used in production
Cloudflare
Terminates and caches HTTP and HTTP/3 requests at 300-plus edge locations, serving cached responses in milliseconds and only forwarding misses to the origin.
NGINX
One of the most widely deployed HTTP servers and reverse proxies, routing and load-balancing HTTP traffic for a large share of the busiest sites on the web.
Co-designed HTTP/2 from its SPDY protocol and HTTP/3 from QUIC, and rolled both out across Chrome and its services to cut page load latency.
Fastly
Runs an HTTP-based edge cloud where customers shape responses using HTTP cache headers and edge logic to serve high-traffic media and commerce sites.
Frequently asked questions
- Is HTTP the same as HTTPS?
- They are the same protocol. HTTPS is just HTTP sent over a TLS-encrypted connection, normally on port 443. TLS encrypts the request and response so an eavesdropper cannot read or tamper with them. Every serious site uses HTTPS today, and browsers flag plain HTTP as not secure.
- What does stateless mean in HTTP?
- It means the server does not remember anything about previous requests on its own. Each request must carry everything the server needs, such as a session cookie or a token, to identify the user and the context. State is kept in a database or cache, not in the protocol itself, which is what lets you scale across many identical servers.
- What is the difference between GET and POST?
- GET asks the server for a resource and should not change anything on the server, so it is safe to cache and repeat. POST sends data in the request body to create or trigger something, like submitting a form or logging in, and it is not safe to blindly repeat because it can have side effects.
- Why is HTTP/2 or HTTP/3 faster than HTTP/1.1?
- HTTP/1.1 sends requests largely one at a time per connection, so a slow resource can block others. HTTP/2 multiplexes many requests over a single connection in parallel and compresses headers. HTTP/3 runs over QUIC on UDP, which removes TCP head-of-line blocking and reconnects faster, which helps most on mobile and lossy networks.
- When should I not use HTTP?
- Use something else when you need the server to push data to the client in real time, like live chat, multiplayer games, or live dashboards. HTTP is request-response and pull-based, so for those cases reach for WebSockets, which keep a two-way connection open, or Server-Sent Events for one-way streams from server to client.
Learn HTTP hands-on
This page explains the idea. The full lesson lets you step through the ring as servers join and leave, read the implementation, and check yourself with a quiz. It is one of 760+ lessons in the System Design Masterclass, from your first API call to distributed consensus. Eleven Foundation lessons are free, no signup. Lifetime access is ₹499 in India or $7.99 worldwide, one payment, no subscription.
Related lessons
Lessons that touch on HTTP as part of a larger topic.
Varnish Cache
The HTTP accelerator that sits in front of your web server, caching full HTTP responses at wire speed
foundation · caching strategies
REST API
Standard web service architecture using HTTP methods and resource-based URLs
foundation · core fundamentals
Ingress Controllers
Routing external HTTP traffic to the right Kubernetes service, the cluster's front door
intermediate · kubernetes containers
Webhooks
Don't call us, we'll call you, server-to-server event notifications over HTTP
intermediate · messaging event systems
Gzip Compression
Compressing HTTP responses to reduce transfer size by 60-80%, the lowest-effort highest-impact performance optimization
intermediate · web content delivery
See also
Related glossary terms you might want to look up next.
REST API
An architectural style for building APIs using standard HTTP methods (GET, POST, PUT, DELETE). Resources are identified by URLs.
TCP
A reliable transport protocol that guarantees data arrives in order and without errors. It uses a three-way handshake to establish connections.
SSL/TLS
Cryptographic protocols that encrypt data in transit between client and server. TLS is the modern successor to SSL. The 'S' in HTTPS.
Latency
The time delay between sending a request and getting a response. Amazon found every 100ms of extra latency costs 1% in sales.
Throughput
The number of operations a system can handle per unit of time. Think of it as how many cars a highway can move per hour.
Bandwidth
The maximum amount of data that can be transferred over a network in a given time. It's the width of the pipe, not how fast the water flows.