# What is HTTP?

> HTTP is the request and response protocol browsers and APIs use to fetch resources over a reliable connection.

Source: https://fullbytedeveloper.com/blog/what-is-http
Published here: 2026-12-03, updated 2026-12-03

HTTP is the protocol for fetching resources such as HTML documents: clients send requests, servers send responses [1]. It is the foundation of ordinary web data exchange on the public internet [1]. Related: [what is an API](/blog/what-is-an-api), [what is a server](/blog/what-is-a-server), [how DNS works](/blog/how-dns-works).

## Quick start (under a minute)

Fetch response headers only:

```bash
curl -sI https://example.com
```

You should see an HTTP status line (`HTTP/2 200` or `HTTP/1.1 200`), then headers such as `content-type`. That is a response without downloading the HTML body.

## See a real response header block on this host

MDN: HTTP is a client-server protocol. The user agent initiates; the origin server responds [1]. A single web page is usually many requests (HTML, CSS, scripts, images) [1].

Observed on this draft host (curl 8.5.0, 2026-12-03):

```text
HTTP/2 200 
date: Thu, 03 Dec 2026 10:01:15 GMT
content-type: text/html; charset=utf-8
server: cloudflare
last-modified: Tue, 01 Dec 2026 18:03:11 GMT
allow: GET, HEAD
accept-ranges: bytes
age: 2
cf-cache-status: HIT
cf-ray: a641baa1beecaa47-IAD
alt-svc: h3=":443"; ma=86400
```

Status `200` means the request succeeded for this GET/HEAD [1] [2]. `content-type` tells the client how to interpret the body. `cf-cache-status` is a CDN header, not part of HTTP core, but it shows how proxies sit in the path MDN describes [1].

RFC 9110 consolidates modern HTTP semantics (methods, status codes, header rules) [2]. RFC 9112 documents HTTP/1.1 wire format if you need line-oriented examples [3].

## Draw one round trip before TLS details

<figure aria-label="HTTP stack from app through TLS TCP and IP">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 280" role="img" aria-hidden="true">
  <defs>
    <marker id="whatishttp-http-arr" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto">
      <path d="M0,0 L8,4 L0,8 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="360" height="280" rx="12" fill="#0b1f3a"/>
  <rect x="25.7143" y="19.5" width="102.857" height="45" rx="4" fill="#123052" stroke="#14b8a6" stroke-width="0.964286"/>
  <text x="77.1429" y="46" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">app / browser [1]</text>
  <rect x="25.7143" y="63.5" width="102.857" height="45" rx="4" fill="#123052" stroke="#14b8a6" stroke-width="1.28571"/>
  <text x="77.1429" y="90" text-anchor="middle" font-size="12" font-weight="600" fill="#e6edf7" font-family="system-ui,sans-serif">HTTP [1] [2]</text>
  <rect x="25.7143" y="107.5" width="102.857" height="45" rx="4" fill="#123052" stroke="#14b8a6" stroke-width="0.964286"/>
  <text x="77.1429" y="134" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">TLS (HTTPS)</text>
  <rect x="25.7143" y="151.5" width="102.857" height="45" rx="4" fill="#123052" stroke="#14b8a6" stroke-width="0.964286"/>
  <text x="77.1429" y="178" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">TCP [1]</text>
  <rect x="25.7143" y="195.5" width="102.857" height="45" rx="4" fill="#123052" stroke="#14b8a6" stroke-width="0.964286"/>
  <text x="77.1429" y="222" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">IP</text>
  <rect x="231.429" y="19.5" width="102.857" height="45" rx="4" fill="#123052" stroke="#14b8a6" stroke-width="0.964286"/>
  <text x="282.857" y="46" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">origin server [1]</text>
  <line x1="128.571" y1="86" x2="228.857" y2="42" stroke="#14b8a6" stroke-width="0.964286" marker-end="url(#whatishttp-http-arr)"/>
  <text x="180" y="58" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">GET request</text>
  <line x1="228.857" y1="54" x2="128.571" y2="98" stroke="#14b8a6" stroke-width="0.964286" marker-end="url(#whatishttp-http-arr)"/>
  <text x="180" y="108" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">200 response</text>
  <text x="180" y="256" text-anchor="middle" font-size="12" fill="#e6edf7" font-family="system-ui,sans-serif">DNS names the hop first [1]</text>
</svg>
</figure>

HTTPS wraps the same HTTP messages in TLS. The method, path, status, and headers remain HTTP [1].

## Read a tiny HTTP/1.1 message shape

Teaching snippets often use HTTP/1.1 text for readability [3]. A GET sketch aligned with MDN's overview [1]:

```http
GET / HTTP/1.1
Host: developer.mozilla.org
Accept-Language: en
```

A successful response starts with version, status code, headers, blank line, then body [1] [2]. Common methods include `GET` (fetch), `POST` (submit), `PUT`/`PATCH` (replace or update), `DELETE` (remove). Safe/idempotent rules live in RFC 9110 [2].

Headers carry metadata: `Content-Type`, `Cache-Control`, `Authorization`, `Cookie`. Bodies carry form data, JSON, or HTML when present [1].

## Separate name lookup from the HTTP exchange

Before the first HTTP byte, the client usually resolves a hostname ([how DNS works](/blog/how-dns-works)). Then TCP (and TLS for HTTPS) opens a connection to the resolved address ([what is a server](/blog/what-is-a-server)).

When someone says "the API is down," ask which layer failed: DNS, TCP, TLS handshake, or an HTTP status such as `503`. CI pipelines that curl health endpoints repeat the same stack ([what is CI/CD](/blog/what-is-ci-cd)).

## Remember the design traits MDN highlights

HTTP is designed to be simple and extensible via headers [1]. It is stateless at the core; cookies and tokens add session state when sites need it [1]. It expects a reliable transport, typically TCP [1] [2].

Caching, authentication, and content negotiation are all header-driven contracts [1]. That is why reverse proxies can cache `GET` responses or strip sensitive headers without changing application code.

## Status codes you will see in logs

RFC 9110 groups statuses by class [2]:

| Range | Meaning | Examples |
|---|---|---|
| 1xx | Informational | `100 Continue` (expect/continue flows) |
| 2xx | Success | `200 OK`, `204 No Content` |
| 3xx | Redirection | `301 Moved Permanently`, `304 Not Modified` |
| 4xx | Client error | `400 Bad Request`, `404 Not Found`, `429 Too Many Requests` |
| 5xx | Server error | `502 Bad Gateway`, `503 Service Unavailable` |

`304` is not an error: it tells the client to use a cached representation when validators match. `503` with `Retry-After` is a capacity signal, not necessarily a code bug.

## Methods at a glance

Safe methods should not change server state when used as intended [2]. `GET` and `HEAD` are safe for retrieval. `POST` is unsafe and common for creates and actions. `PUT` and `DELETE` target resources with idempotency rules spelled out in RFC 9110. APIs document which method maps to which business operation ([what is an API](/blog/what-is-an-api)).

`OPTIONS` and `TRACE` appear in debugging and CORS preflight. Most application authors interact with GET, POST, PATCH, and DELETE daily.

## Headers worth learning early

`Host` is required in HTTP/1.1 name-based virtual hosting [3]. `Content-Type` tells parsers how to decode the body. `Cache-Control` and `ETag`/`If-None-Match` drive conditional GETs that save bandwidth [1] [2]. `Authorization` carries bearer tokens or schemes; cookies ride in their own headers when sessions exist [1].

Mis-set `Content-Type` on JSON APIs produces clients that silently mis-parse. Mis-set `Cache-Control` on authenticated pages leaks private data through shared caches. Headers are contracts, not decoration.

## Trace one curl verbosely (optional)

```bash
curl -svo /dev/null https://example.com 2>&1 | head -20
```

stderr shows TLS negotiation and request headers curl sends; stdout would hold the body. Use this when a browser works but a script fails: compare `Host`, SNI, and redirects.

## Proxies and intermediaries MDN names

MDN lists proxies that can cache, filter, load-balance, or terminate TLS [1]. Corporate proxies may rewrite headers. CDNs may serve stale assets when `Cache-Control` allows. None of that changes HTTP semantics at the origin; it adds actors between client and server. Debug with `curl -v` from the same network path your app uses.

## Bodies and transfer encodings

Small JSON APIs often send a known `Content-Length`. Streaming responses may use chunked transfer encoding so the server need not know the final size upfront [3]. HTTP/2 frames bodies differently but still ends in bytes the client reassembles. Size mismatches and truncated downloads show up as parser errors or incomplete JSON, not always as HTTP error statuses.

## Connection reuse and keep-alive

HTTP/1.1 defaults to persistent connections unless either side closes [3]. Clients reuse TCP sessions for many requests to the same host, which is why one HTML page triggers parallel connections or multiplexed HTTP/2 streams instead of one serial connection per asset [1]. Connection errors mid-page show as partial loads even when the first request returned 200.

## Failure modes worth naming

Equating HTTP with HTML. HTTP is the envelope; HTML, JSON, and images are bodies.

One request equals one page. Modern pages trigger dozens of parallel requests. Performance work counts waterfalls, not only the first document [1].

Treating all 4xx/5xx as "server down." `404` is often a routing mistake. `401`/`403` are auth. `429` is rate limits. `502`/`503` are upstream or capacity. Read the status and body.

Ignoring idempotency on `POST`. Retrying payments or creates can duplicate side effects. HTTP semantics distinguish safe methods from unsafe ones [2].

Confusing HTTP/2 with WebSockets. HTTP/2 is still request-response multiplexed on TCP. WebSockets upgrade to a different full-duplex channel.

Save one raw request and response pair from `curl -v` the next time a service fails. Name lookup from [how DNS works](/blog/how-dns-works) and the process behind [what is a server](/blog/what-is-a-server) narrow which layer broke; [what is an API](/blog/what-is-an-api) is where methods and status codes become product contracts instead of wire trivia. For how libraries and frameworks sit on top of those requests, see [framework vs library](/blog/framework-vs-library).

Send this to the friend who says HTTP when they mean the whole browser stack.

Image: Dark slab and cube flanking a vertical stack of glass panes with cyan and amber rings and opposing arrows above, no people and no readable text.
https://fullbytedeveloper.com/media/what-is-http/what-is-http-venice.webp
HTTP sits above transport; TLS wraps the wire on HTTPS.

## Sources

1. [MDN: Overview of HTTP, accessed 2026-12-03](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Overview)
2. [RFC 9110: HTTP Semantics, accessed 2026-12-03](https://www.rfc-editor.org/rfc/rfc9110)
3. [RFC 9112: HTTP/1.1, accessed 2026-12-03](https://www.rfc-editor.org/rfc/rfc9112)
4. [Full Byte Developer: What is an API](https://fullbytedeveloper.com/blog/what-is-an-api)
5. [Full Byte Developer: What is CI/CD](https://fullbytedeveloper.com/blog/what-is-ci-cd)
6. [Full Byte Developer: What is a server](https://fullbytedeveloper.com/blog/what-is-a-server)
7. [Full Byte Developer: How DNS works](https://fullbytedeveloper.com/blog/how-dns-works)
