Web Security

HTTP

About 5 min read

What Is HTTP

HTTP (HyperText Transfer Protocol) is the communication protocol that governs how web browsers and servers exchange data. RFC 9110 notes that HTTP has been the primary information transfer protocol for the World Wide Web since its introduction in 1990; it began as a simple mechanism with a single method (GET) for requesting a document identified by a pathname, was extended as the Web grew, and those protocols were eventually defined as HTTP/0.9 and HTTP/1.0. The protocol now carries a wide range of resources, from HTML pages and images to JSON API responses and streaming video. The specification was reorganized in June 2022 into RFC 9110 (semantics), RFC 9111 (caching), and RFC 9112 (HTTP/1.1 message syntax), which obsoleted the RFC 7230 series that had replaced RFC 2616 in June 2014.

When you type a URL into your browser, an HTTP request is sent to the server, which processes it and returns an HTTP response - this round trip is the fundamental mechanism behind every web page you visit. HTTP is a stateless protocol, meaning each request is independent and carries no memory of previous interactions. Maintaining state (such as login sessions) requires mechanisms like cookies or authentication tokens.

Request and Response Structure

HTTP communication follows a simple client-server model: the client sends a request, and the server returns a response.

Request Components
The method (GET, POST, PUT, DELETE) specifies the intended action. The URL path identifies the target resource. Headers carry metadata such as browser type (User-Agent), accepted formats (Accept), and authentication credentials (Authorization). POST and PUT requests include a body containing form data or JSON payloads.
Response Components
The status code (200, 404, 500) indicates the result. Headers include content type (Content-Type), caching directives (Cache-Control), and security headers. The body contains the actual data - HTML, JSON, image binary, or other content.

GET requests retrieve resources and normally carry no body: RFC 9110 states that content in a GET request has no generally defined semantics and that a client SHOULD NOT send it unless the origin server has previously indicated that such a request has a purpose and will be adequately supported. POST submits data (form submissions, API calls) with a body. REST APIs also use PUT (update), DELETE (remove), and PATCH (partial update).

Key Status Codes

HTTP status codes are three-digit numbers that categorize server responses. RFC 9110 specifies that the first digit determines the class of the response.

2xx (Success)
200 OK means the request succeeded. 201 Created confirms a new resource was created. 204 No Content indicates success with no response body (common after DELETE).
3xx (Redirection)
301 Moved Permanently signals a permanent URL change. RFC 9110 defines it as indicating that the target resource has been assigned a new permanent URI and that future references ought to use one of the enclosed URIs. 302 Found is a temporary redirect. 304 Not Modified tells the client its cached version is still valid.
4xx (Client Error)
400 Bad Request for malformed syntax. 401 Unauthorized when authentication is required. 403 Forbidden when access is denied. 404 Not Found when the resource does not exist. 429 Too Many Requests when rate limits are exceeded.
5xx (Server Error)
500 Internal Server Error is a generic server failure. 502 Bad Gateway occurs when a reverse proxy receives an invalid response from the backend. 503 Service Unavailable indicates temporary downtime due to maintenance or overload.

In API design, returning a code that matches the result lets clients branch between success and error handling by the first digit of the code.

HTTP Version Evolution

HTTP has been revised over the more than three decades since its introduction in 1990, with each version addressing performance issues of its predecessor.

HTTP/1.1 (1997)
Specified in RFC 2068 in January 1997 and reorganized as RFC 9112 in June 2022. Introduced persistent connections (Keep-Alive), chunked transfer encoding, and virtual hosting via the Host header. RFC 9112 also defines pipelining, which sends multiple requests without waiting for each response, but the server must return responses in the order the requests were received, so Head-of-Line Blocking, where a slow response delays the ones behind it, remains an issue.
HTTP/2 (2015)
Standardized as RFC 7540 in May 2015 and revised as RFC 9113 in June 2022. Enables multiplexing - multiple requests and responses in parallel over a single TCP connection - while header compression (HPACK) reduces overhead. Server push, which delivers resources before the client asks for them, is also specified, but a Chrome developer blog post (updated August 18, 2022) reports that it is disabled by default in Chrome 106 and names 103 Early Hints as an alternative. TCP-level Head-of-Line Blocking also remains an issue.
HTTP/3 (2022)
Standardized as RFC 9114 in June 2022. Replaces TCP with QUIC (UDP-based, RFC 9000), eliminating TCP Head-of-Line Blocking entirely. The initial handshake takes 1-RTT, and 0-RTT resumption is available for a peer the client has reached before. Because a session is identified by a connection ID rather than an IP address, connections survive network transitions such as Wi-Fi to cellular. Servers advertise availability through the Alt-Svc header, and clients without support fall back to HTTP/2 or earlier.

As for the relationship with HTTPS, RFC 9113 for HTTP/2 deprecated the Upgrade mechanism for switching to cleartext HTTP/2 (h2c) because it was never widely deployed. For QUIC, the foundation of HTTP/3, RFC 9001 states that clients MUST NOT offer TLS versions older than 1.3.

HTTP vs HTTPS

HTTP transmits data in plaintext, making it vulnerable to eavesdropping and tampering by anyone on the network path. HTTPS adds a TLS encryption layer on top of HTTP, securing the communication channel.

  • HTTP: Uses port 80. Data is unencrypted. The Chromium project page says Chrome has marked all HTTP pages as "Not Secure" since Chrome 68 (July 2018). According to hstspreload.org as of October 2026, browsers such as Chrome and Safari automatically upgrade HTTP page navigations to HTTPS regardless of whether an HSTS policy exists.
  • HTTPS: Uses port 443. TLS-encrypted. Google announced in August 2014 that it had started using HTTPS as a ranking signal, describing it at the time as a very lightweight signal affecting fewer than 1% of global queries.

HTTP remains the underlying protocol even where HTTPS is the de facto standard. The request-response model, methods, headers, and status codes are identical in both - HTTPS simply wraps the HTTP exchange in an encrypted tunnel. Understanding HTTP fundamentals is essential for working with HTTPS, debugging with developer tools, and designing APIs.

One practical pitfall is judging encryption by what the address bar looks like. A Chromium blog post (May 2023) announced that Chrome 117, scheduled for early September 2023, would replace the lock icon on desktop with a variant of the tune icon that opens site settings. Chrome's support page explains that the icon to the left of the web address shows how secure the connection is, and whether the connection is encrypted can also be told from whether the URL scheme is https://. HTTPS also guarantees only channel encryption and the identity of the domain reached; it says nothing about whether the operator is trustworthy or the content accurate. Phishing sites can also obtain DV certificates and use HTTPS, and the same support page advises checking the site name in the address bar to confirm you are on the right site.

Common Misconceptions

HTTP and HTTPS are completely different protocols
HTTPS is HTTP with TLS encryption added on top. The request-response structure, methods, and status codes are identical. The mechanics of HTTP apply to HTTPS as they are - the difference is the TLS encryption layer plus the URL scheme and default port (80 versus 443) that come with it.
Upgrading to HTTP/2 or HTTP/3 always makes sites faster
HTTP/2 multiplexing and HTTP/3 QUIC improve network-level efficiency, but if the bottleneck is server-side processing, database queries, or frontend rendering, the perceived speed may not change. Protocol upgrades optimize the transport layer, not the entire application stack.
HTTP is an obsolete technology no longer in use
HTTPS became the de facto standard for public websites, but HTTP is still used directly in settings such as local development environments. HTTP also forms the foundation of HTTPS - the protocol itself is the same, with TLS encryption layered on top.
Share

Related Terms

Related Articles