]> git.kaiwu.me - nginx.git/commit
Proxy: fixed HTTP/2 upstream with revalidated cache send master
authorZhidao HONG <z.hong@f5.com>
Tue, 19 May 2026 07:59:56 +0000 (07:59 +0000)
committerhongzhidao <hongzhidao@gmail.com>
Tue, 14 Jul 2026 12:38:57 +0000 (20:38 +0800)
commit9e32c636c7a483e79e2545525700b42cfa807c67
treefdc6b837296692447a6e8072279a95d8f3e95456
parent44c66e92c88bf2367dd31efc9d5843c0838d11f2
Proxy: fixed HTTP/2 upstream with revalidated cache send

Previously, a revalidated cached response could fail on a cached
keepalive connection with "upstream sent frame for unknown stream"
error followed by "cache file contains invalid header".

This happened because after a 304 response, nginx parsed the cached
response while the upstream peer connection was still attached to the
request.  The HTTP/2 proxy code treated cached frames as frames from
that live connection, and could assign a real stream id instead of
treating the cached response as having no real stream.

The fix is to treat cached response parsing as cache-only regardless
of the current upstream peer connection: set the stream id to 0 and
skip live upstream control-frame handling while r->cached is set.

Closes: https://github.com/nginx/nginx/issues/1318
src/http/modules/ngx_http_proxy_v2_module.c