Use conditional slicing

This commit is contained in:
Goten Xiao 2022-04-23 22:13:57 +01:00
parent d01c26ae0d
commit 1bbb96230c
3 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,4 @@
map "${cacheidentifier}${http_range}" $slice_range_actual {
default $slice_range; # Use the calculated slice range by default
~steam$ ""; # Disable slicing for Steam when the client request isn't a range, as not all CDN nodes accept range requests
}

View file

@ -4,7 +4,8 @@
proxy_ignore_headers Expires Cache-Control;
proxy_cache_valid 200 206 CACHE_MAX_AGE;
proxy_set_header Range $slice_range;
# $slice_range_actual is set from the map in 31_slice_maps.conf
proxy_set_header Range $slice_range_actual;
# Only download one copy at a time and use a large timeout so
# this really happens, otherwise we end up wasting bandwith

View file

@ -1 +1 @@
proxy_cache_key $cacheidentifier$uri$slice_range;
proxy_cache_key $cacheidentifier$uri$slice_range_actual;