Pcornel
Browse topics
Options
Recent
Favorites
Web Infrastructure · Technical reference

HTTP/1.1

Direct answer

HTTP/1.1 sends requests and responses as text over a TCP connection, one exchange at a time per connection, with persistent (keep-alive) connections by default.

When to use this

Use it to read raw requests, to understand keep-alive and connection limits between proxies and backends, and to diagnose framing problems such as wrong Content-Length or request smuggling.

First 30 seconds

1. Is Host correct?

2. Is the body framed by Content-Length or chunked, consistently?

3. Are connections reused or closed after every request?

4. Are proxy and backend timeouts aligned (proxy shorter than backend idle timeout)?

Operational verification

TCP (+TLS) → request line + headers + body → response status + headers + body → connection reused or closed

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
HTTP/1.1 per RFC 9112.
Applicability is projected only from persisted Topic profile and Command metadata.
At a glance

Operational reference

Fast context before you go deeper.

PlatformHTTP/1.1 per RFC 9112.
Key commandss -tn state established '( dport = :8080 )'
Scope / prerequisiteUse it to read raw requests, to understand keep-alive and connection limits between proxies and backends, and to diagno…
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Read-only Verification Verify boundary
# Force HTTP/1.1 and show the exchange
curl -v --http1.1 https://www.example.com/ -o /dev/null

# Two requests on one connection: curl reports "Re-using existing connection"
curl -v --http1.1 https://www.example.com/a https://www.example.com/b -o /dev/null -o /dev/null

# Established connections from the proxy to a backend on port 8080
ss -tn state established '( dport = :8080 )'

A proxy that opens a new backend connection per request shows a constantly changing set of source ports and many sockets in TIME-WAIT; with upstream keepalive the same few connections stay established.

Step 2 Common mistakes Narrow the fault
  • Assuming pipelining is used; it effectively is not.
  • Proxy idle timeout longer than the backend's.
  • Setting Content-Length in the application and then compressing the body in a later layer.
  • Running old proxies in front of new servers (or the reverse) without checking for smuggling fixes.
Step 3 Troubleshooting Narrow the fault

400 Bad Request or 431 for some users only. Oversized cookies or headers; compare limits on CDN, proxy and server.

Intermittent 502 on idle-then-busy traffic. The backend closed a kept-alive connection just as the proxy reused it. Make the backend's keepalive timeout longer than the proxy's, or enable retries for idempotent requests.

Response truncated. Content-Length does not match the body actually sent (application bug, compression added after the length was set).

Many TIME-WAIT sockets on the proxy. No upstream keepalive; enable it (for nginx: keepalive in the upstream block, HTTP/1.1 and an empty Connection header).

Key points

Host is mandatory. Connections persist unless Connection: close. A body is framed by Content-Length or Transfer-Encoding: chunked — never both. Browsers open several connections per host because each carries one request at a time.

Key checks
  • curl -v --http1.1 https://<host>/ — raw request line and headers.
  • printf 'GET / HTTP/1.1\r\nHost: <host>\r\nConnection: close\r\n\r\n' | openssl s_client -quiet -connect <host>:443 -servername <host> — hand-written request.
  • Proxy upstream keepalive settings and connection counts (ss -tn state established dport = :<port>).
ReferenceWhat it is2 sections · depth on demand

Direct Answer

HTTP/1.1 sends each message as text: a request line (GET /path HTTP/1.1), header fields, a blank line and an optional body. Connections are persistent by default, so several requests can use the same TCP connection — but only one at a time, which is why browsers open several connections per host. The Host header is mandatory, and a body is framed either by Content-Length or by Transfer-Encoding: chunked. HTTP/1.1 is still the usual protocol between reverse proxies and backends.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Message format

GET /index.php HTTP/1.1
Host: www.example.com
User-Agent: curl/8.5.0
Accept: */*

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 5120
Cache-Control: no-cache

Lines end with CRLF. Header names are case-insensitive. A request without Host gets 400.

Connection management

MechanismBehaviour
Persistent connectionsDefault in HTTP/1.1; Connection: close ends after the response
PipeliningSending several requests without waiting — defined, but browsers do not use it; responses must come back in order
Head-of-line blockingA slow response blocks every later request on that connection
Parallel connectionsBrowsers open several (typically up to six) connections per origin

Between a reverse proxy and its backend, reusing connections (upstream keepalive) saves a TCP and often a TLS handshake per request. The proxy's idle timeout should be shorter than the backend's, otherwise the proxy may send a request on a connection the backend has just closed.

Body framing

  • Content-Length: N — exactly N bytes follow.
  • Transfer-Encoding: chunked — the body arrives in chunks, each prefixed with its size in hex, ending with a zero-length chunk. Used when the length is not known in advance (streaming, compressed on the fly).

A message with both headers, or with conflicting values, is ambiguous. If a front-end proxy and a backend interpret it differently, an attacker can hide a second request inside the first: request smuggling. Current servers reject or normalise such messages; keep proxies and servers patched and avoid mixing very old components.

Upgrade

A client can ask to switch protocols with Upgrade: and Connection: Upgrade; the server answers 101 Switching Protocols. This is how WebSocket starts over HTTP/1.1. The old cleartext upgrade to HTTP/2 (h2c) is deprecated by RFC 9113.

Limits that produce errors

Header size limits (large cookies → 400 or 431), body size limits (413), and URI length limits (414) are set separately on every hop.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
http/1.1http 1.1keep-alivechunked transfer encodingrequest smuggling
Confirmation

Confirm action

Continue?