This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
2021-05-31 18:27:56 +00:00
|
|
|
set $nocache 0; # internal variable for bypassing the cache, nginx expects 0/1 for boolean
|
|
|
|
proxy_cache skynet; # cache name
|
2020-09-01 13:26:48 +00:00
|
|
|
slice 1m;
|
|
|
|
proxy_http_version 1.1; # upgrade if necessary because 1.0 does not support byte-range requests
|
|
|
|
proxy_set_header Range $slice_range; # pass slice range to proxy
|
2020-11-26 14:49:54 +00:00
|
|
|
proxy_cache_key $uri$arg_format$arg_attachment$slice_range; # use just the uri path, format and attachment args and slice range
|
2020-09-01 13:26:48 +00:00
|
|
|
proxy_cache_min_uses 3; # cache responses after 3 requests of the same file
|
|
|
|
proxy_cache_valid 200 206 24h; # cache 200 and 206 responses for 24 hours
|
2021-01-15 15:11:06 +00:00
|
|
|
proxy_cache_lock on; # queue cache requests for the same resource until it is fully cached
|
2021-05-31 18:27:56 +00:00
|
|
|
proxy_cache_bypass $nocache $cookie_nocache $arg_nocache; # add cache bypass option
|
2020-09-01 13:26:48 +00:00
|
|
|
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses
|