Glossary › Web Development › Http

Http

HTTP (Hypertext Transfer Protocol) is the stateless, application-level protocol that clients and servers use to exchange requests and responses on the web. A browser can use HTTP to request an HTML document, image, stylesheet, script, or API data; the server answers with a response that describes the result and may include the requested content.

How does HTTP work?

  1. The client identifies a resource with a URL and sends an HTTP request. The request includes a method, a target, headers, and sometimes content.
  2. The server interprets the request and returns an HTTP response. The response includes a status code, headers, and, when appropriate, content.
  3. The client uses the response. For example, after receiving an HTML document, a browser usually makes more HTTP requests for its CSS, JavaScript, images, and other resources.

Loading a page is therefore not usually one transfer. It is a series of request-and-response exchanges that can also pass through caches, proxies, or load balancers before reaching the origin server.

HTTP methods and status codes

A request method communicates what the client intends to do. GET asks for a representation of a resource, POST submits information for processing, PUT creates or replaces a resource at a known target, and DELETE requests its removal. An application's behavior still depends on how its server implements those methods.

A response status code summarizes the outcome. Codes in the 2xx range indicate success, 3xx codes describe redirection, 4xx codes indicate a client-side problem with the request, and 5xx codes indicate that the server failed to fulfill an apparently valid request. Common examples include 200 OK, 301 Moved Permanently, 404 Not Found, and 500 Internal Server Error.

Why is HTTP called stateless?

HTTP is stateless because each request can be understood independently; the protocol does not automatically remember earlier requests. Websites can still provide logged-in accounts, shopping carts, and other continuity by sending identifiers such as cookies with later requests and storing the related session or account state separately.

What is the difference between HTTP and HTTPS?

HTTPS is HTTP communicated over a connection protected with Transport Layer Security (TLS). TLS encrypts data in transit, helps detect tampering, and lets the client verify the server's identity through its certificate. The underlying HTTP methods, status codes, headers, and request-response semantics still apply. Public websites should use HTTPS rather than send private or editable traffic over an unencrypted connection.

HTTP/1.1, HTTP/2, and HTTP/3

These major versions use the same core HTTP semantics but differ in how messages are represented and transported. HTTP/2 can multiplex concurrent exchanges over one connection and compresses header fields. HTTP/3 carries HTTP over QUIC, which changes the transport behavior while preserving familiar requests, responses, methods, and status codes.

Further reading