Transport and response framing
Separate client and upstream protocols
HTTP semantics are shared across versions, but message transport differs. HTTP/1.1 uses text start lines and framing rules; HTTP/2 multiplexes streams over TCP, and HTTP/3 uses QUIC over UDP. TLS ALPN negotiates a protocol on a supported connection. An edge can accept HTTP/2 or HTTP/3 while talking HTTP/1.1 to a backend. Explicitly select upstream HTTP/1.1 on the local 1.26.3 baseline. Frontend HTTP/2 and HTTP/3 require the appropriate build, listener and TLS settings; QUIC also requires reachable UDP. Later versions have different upstream capabilities and defaults, so check the exact release.
Client -- HTTPS + h2/h3 (if negotiated) --> NginxNginx -- HTTP/1.1 --> applicationTwo connections; two transport choicesReason about framing and buffering
HTTP/1.1 can frame a known body with Content-Length or an unknown-length stream with chunked transfer coding. Do not send both framing fields together. HTTP/2 and HTTP/3 use their own frames rather than HTTP/1.1 chunked transfer coding. A proxy may decode and reframe a message, so body bytes and semantics matter more than identical wire bytes. Request buffering stores the incoming body before sending; response buffering decouples reads from writes using memory and potentially temporary files. Disabling it may reduce delay for streaming but ties backend progress to slow clients. Use supported serializers, reject ambiguity defensively, and consult RFC 9112 and its RFC 9931 update for protocol transition safety.
# Location fragment for a reviewed streaming endpointproxy_http_version 1.1;proxy_request_buffering on;proxy_buffering off;Validate a partial response
A range request asks for a subset of a representation. For the ten-byte file 0123456789, a supported bytes=2-5 request returns four bytes, 2345, with a 206 response and a Content-Range describing the interval and total size. The server may choose not to honor a range; an unsatisfiable supported range can yield 416. This is a safe ordinary local fixture. Do not assume a compressed representation has the same byte offsets as an uncompressed one.
GET /sample.txt HTTP/1.1Host: localhostRange: bytes=2-5
# Expected for the lab file: 206, Content-Range: bytes 2-5/10Use validators for conditional requests
An ETag represents a selected representation version; it is opaque to the client. A client can send If-None-Match using a previously received tag to avoid downloading unchanged data. A matching conditional GET can produce 304 with no response body. HEAD also omits a response body even if a Content-Length describes the corresponding GET. Preserve cache metadata and validate conditional semantics with the actual origin. Never assume every 200 carries a body or use a 304 as application authorization.
GET /sample.txt -> 200, ETag: <observed-tag>GET /sample.txt + If-None-Match: <observed-tag>-> 304, no body (if still unchanged)Apply what you learned
Practice: For a ten-byte uncompressed file, predict GET with Range bytes=2-5, HEAD, and GET with a matching ETag. Explain why frontend HTTP/2 does not force upstream HTTP/2. The manual exercise and quiz are staged separately. Related references and the next lesson are listed in the chapter authored map.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Transport and response framing
Assess HTTP processing, framing and retry reasoning.
Can an HTTP/2 client use an HTTP/1.1 upstream?
What is chunked coding used for?
What does disabling response buffering change?
Which body matches bytes=2-5 for 0123456789?
What does a matching If-None-Match GET commonly yield?