Change History
(4)

set $demo_cache_key $scheme://demo.ogslb.com$uri$is_args$args$slice_range;

is evaluated only once - at main request's rewrite phase. Slice subrequests retain the old value of this key with the initial $slice_range equal to bytes=0-4194303. That's why for the second slice in fact the first slice is fetched again, which causes the error.

To fix the issue, eliminate the variable and set proxy_cache_key directly.