Skip to content

Tests: slice subrequest redirected to a named location - #98

Open
climagabriel wants to merge 1 commit into
nginx:masterfrom
climagabriel:slice_named_location_ctx
Open

Tests: slice subrequest redirected to a named location#98
climagabriel wants to merge 1 commit into
nginx:masterfrom
climagabriel:slice_named_location_ctx

Conversation

@climagabriel

Copy link
Copy Markdown

Companion test for nginx/nginx#1611.

When a slice subrequest is redirected into a named location — e.g. by error_page 302 with proxy_intercept_errors on — the subrequest's slice context is lost: $slice_range evaluates to an empty value, the re-proxied request goes upstream without a Range header, and the origin's complete 200 response is appended to the parent response and cached under a sliceless key.

The repro is all-nginx, no external daemon: a second server block serves a 16-byte file and returns 302 only for the Range: bytes=2-3 slice fetch, so the second slice — a subrequest — takes the error_page 302 = @redirect path, which re-proxies $upstream_http_location.

The test asserts the fixed behavior and passes with nginx/nginx#1611 applied (11/11). Without the fix it fails on: the corrupt reassembled body, 2 cache entries instead of 8 (the sliceless key holding a complete response), no cache HIT for the redirected slice, and the "missing slice response" error line.

Note for reproducers: proxy_pass $upstream_http_location directly evaluates to an empty value (the proxy handler recreates the upstream before evaluating its URL); the named location captures it with set in the rewrite phase first.

Tests for the slice context lost when a slice subrequest is redirected
into a named location, for example by "error_page 302" with
"proxy_intercept_errors on" (see nginx/nginx#1611): $slice_range
evaluated to an empty value in the redirected subrequest, the origin's
complete 200 response was appended to the parent response and cached
under a sliceless key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants