NGINX 1.31.9: Stricter header parsing, flood detection for chunked request bodies, and protocol fixes for HTTP/2 and HTTP/3

—

by

in ,

NGINX Open Source 1.31.9 changes how NGINX parses and schedules HTTP traffic. A header line without a colon now fails the request instead of passing through as an empty header, and chunked uploads get flood detection. Several HTTP/2 and HTTP/3 fixes keep traffic moving and headers intact.

The rest of the release covers stability. Proxied requests no longer hang while NGINX discards a request body, cookie variables read correctly after a cookie with no name, and the GeoIP modules reject invalid coordinates. Two changes can stop a working setup: the header parsing change, and worker processes that now exit when initgroups() fails. Check the upgrade notes before you move to NGINX Open Source 1.31.9.

Release highlights

  • Stricter header parsing: Reject header lines without a colon, instead of passing them on as empty headers.
  • Flood detection for chunked request bodies: Stop clients that send chunked uploads made mostly of framing.
  • HTTP/2 and HTTP/3 protocol fixes: Keep HTTP/2 streams moving, and pass HTTP/3 headers through unchanged.
  • Stability and bug fixes: Updates to proxied request bodies, cookie variables, GeoIP coordinates, the Control API, and TLS and OCSP handling.

Header lines without a colon are rejected

What’s new: NGINX now rejects a header line that has no colon, such as Foo. It used to accept the line as an empty header and pass it on as Foo: . A request with one now gets a 400 error, and an upstream response with one gets the client a 502. The same rule applies to responses from an auth_http server and replies from an OCSP responder (nginx/nginx#1904).

Why it matters: A malformed header line now stops at NGINX instead of reaching your upstream servers or clients as an empty header. RFC 9112 requires the colon.

Flood detection for chunked request bodies

What’s new: NGINX now counts the framing in a chunked request body (chunk sizes, extensions, and trailers) against the body data. If a client sends far more framing than data, NGINX rejects the request with a 400 error. client_max_body_size still limits only the body data (nginx/nginx#1619).

Why it matters: HTTP/1.1 chunked uploads now have the same flood protection HTTP/2 and HTTP/3 already had. The threshold only catches clearly abusive traffic.

HTTP/2 and HTTP/3 protocol fixes

What’s new: Four fixes for HTTP/2 and HTTP/3:

  • HTTP/2 trailers no longer hold back other streams: A response with trailers stopped every frame queued after it, including frames for higher-priority streams. It no longer does (nginx/nginx#1890).
  • HTTP/2 output takes less work to queue: NGINX now places each stream’s frames in the output queue more efficiently (nginx/nginx#1890).
  • Unknown flags in HTTP/2 SETTINGS frames are ignored: NGINX now ignores them, as RFC 9113 requires. Before, an acknowledgment with an extra flag got a second acknowledgment back. Developed by community contributor marek-ludha (nginx/nginx#1795).
  • HTTP/3 headers keep their spacing: Five entries in NGINX’s HTTP/3 header compression table were missing a space, so a header such as text/html; charset=utf-8 reached NGINX as text/html;charset=utf-8. Responses weren’t affected. This fix comes from community contributor Nexory (nginx/nginx#1895).

Why it matters: HTTP/2 priorities hold when applications send trailers, and HTTP/3 request headers reach your configuration and upstream servers exactly as the client sent them.

Stability and bug fixes

  • Proxied requests no longer hang while a request body is discarded: NGINX now sends Content-Length: 0 when it proxies a request whose body it’s still discarding, as with error_page 413 pointing to a proxied location, so the upstream server doesn’t wait for a body that never comes (nginx/nginx#1862).
  • $cookie_ variables find a cookie that follows a cookie without a name: In a header such as Cookie: a; a=1, NGINX skipped a=1 along with the nameless cookie, so $cookie_a and the userid module came back empty (nginx/nginx#1910).
  • GeoIP coordinates outside the valid range are rejected: NGINX now reports an out-of-range latitude or longitude from a MaxMind database as not found, since formatting one could overflow a buffer. Thanks to community contributor u5surf for this fix (nginx/nginx#1908).
  • limit_conn releases a slot after a memory allocation error: A failed allocation could leave a connection counted forever, eventually limiting legitimate clients (nginx/nginx#1869).
  • map regex errors no longer log freed memory: A failing regular expression in a map block is now logged correctly (nginx/nginx#1947).
  • The index directive re-evaluates non-cacheable variables: As try_files already does, so file names built from variables no longer use a stale value (nginx/nginx#1940).
  • The Control API answers an oversized request with 400: Requests that were too long got no response. Community contributor daewoo1109 wrote this fix (nginx/nginx#1924).
  • Single process mode warns about the Control API only when it’s enabled: The warning no longer appears in tools such as OpenResty’s resty. Community contributor piotrp built this (nginx/nginx#1898).
  • TLS session data is cleared from memory after use: NGINX no longer leaves the most recent TLS session in a static buffer (nginx/nginx#1812).
  • OCSP cache keys tell all certificate serial numbers apart: With ssl_ocsp_cache, some pairs of client certificates shared a cache entry, and each now gets its own (nginx/nginx#1927).

Upgrade notes

Before upgrading to NGINX Open Source 1.31.9, please verify your normal application behavior does not rely on any of the items below:

  • Header lines without a colon are rejected: A request with one now gets a 400 error, and an upstream response with one gets the client a 502. This also applies to auth_http servers and OCSP responders, and ignore_invalid_headers off doesn’t change it. If anything you rely on sends such lines, fix it before you upgrade. Headers like Foo:, with a colon and an empty value, are unaffected (nginx/nginx#1904).
  • A worker process exits if initgroups() fails: It used to log the failure and keep running with the wrong supplementary groups. EPERM is still only logged. If your error log shows other initgroups() failures, fix the user’s group lookup before you upgrade (nginx/nginx#1833).

Community recognition

A big thank-you to the community behind NGINX Open Source 1.31.9. Your code, testing, and feedback made this release better.

Community contributions

daewoo1109, marek-ludha, Nexory, piotrp, and u5surf: five community members whose work landed in NGINX Open Source 1.31.9, with two HTTP/2 and HTTP/3 protocol fixes, two Control API fixes, and a GeoIP fix. You’ll find each contribution credited above, next to the change it made. Thanks for being part of this release!

Community inspired development work

The TLS session buffer clearing was inspired by ravikanthreddy89‘s issue, which found that NGINX left the most recent TLS session in memory and sketched the fix that shipped in nginx/nginx#1812. Thanks for getting this started!

Some fixes in this release come from work in the freenginx project, which the NGINX team adapted: rejecting header lines without a colon in HTTP requests and responses (nginx/nginx#1904), sending Content-Length: 0 while a request body is discarded (nginx/nginx#1862), releasing limit_conn slots after a memory allocation error (nginx/nginx#1869), and re-evaluating non-cacheable variables in index (nginx/nginx#1940). We’re grateful for the work behind them.

Help shape NGINX Open Source 1.31.10

Work on NGINX Open Source 1.31.10 is already underway in the open. Pick up an open issue, send a fix for a bug you’ve hit, or propose a feature you’d like to build. The contributing guide walks you through it, from opening a discussion to sending a pull request.


Getting started with NGINX Open Source 1.31.9

NGINX Open Source 1.31.9 is available now as source code and as binary packages for major Linux distributions.

For more release announcements and technical articles, see the NGINX Blog.

Keeping NGINX up to date

We recommend running the latest version of NGINX, since each release includes fixes and improvements. NGINX Open Source 1.31.9 fixes these vulnerabilities:

Each CVE links to its official F5 advisory.

To stay informed, subscribe to F5 notifications and select the relevant advisory updates.

NGINX Community Forum