Tests: slice subrequest redirected to a named location - #98
Open
climagabriel wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion test for nginx/nginx#1611.
When a slice subrequest is redirected into a named location — e.g. by
error_page 302withproxy_intercept_errors on— the subrequest's slice context is lost: $slice_range evaluates to an empty value, the re-proxied request goes upstream without aRangeheader, 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-3slice fetch, so the second slice — a subrequest — takes theerror_page 302 = @redirectpath, 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_locationdirectly evaluates to an empty value (the proxy handler recreates the upstream before evaluating its URL); the named location captures it withsetin the rewrite phase first.