-
Notifications
You must be signed in to change notification settings - Fork 10
/
20_cache.conf
33 lines (26 loc) · 1.27 KB
/
20_cache.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Cache Location
slice 1m;
proxy_cache generic;
proxy_ignore_headers Expires Cache-Control;
proxy_cache_valid 200 206 CACHE_MAX_AGE;
proxy_set_header Range $slice_range;
# Only download one copy at a time and use a large timeout so
# this really happens, otherwise we end up wasting bandwith
# getting the file multiple times.
proxy_cache_lock on;
# If it's taken over a minute to download a 1m file, we are probably stuck!
# Allow the next request to cache
proxy_cache_lock_age 2m;
# If it's totally broken after an hour, stick it in bypass (this shouldn't ever trigger)
proxy_cache_lock_timeout 1h;
# Allow the use of state entries
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
# Allow caching of 200 but not 301 or 302 as our cache key may not include query params
# hence may not be valid for all users
proxy_cache_valid 301 302 0;
# Enable cache revalidation
proxy_cache_revalidate on;
# Don't cache requests marked as nocache=1
proxy_cache_bypass $arg_nocache;
# Smaller proxy_max_temp_file_size for Pis. See https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size
proxy_max_temp_file_size 1024m;