report bypass instead of miss when skyd cache is enabled
This commit is contained in:
parent
87e2a9e3bb
commit
0bd5af87fc
|
@ -4,18 +4,18 @@ proxy_cache_min_uses 3; # cache after 3 uses
|
||||||
proxy_cache_valid 200 206 307 308 48h; # keep 200, 206, 307 and 308 responses valid for up to 2 days
|
proxy_cache_valid 200 206 307 308 48h; # keep 200, 206, 307 and 308 responses valid for up to 2 days
|
||||||
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses
|
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses
|
||||||
|
|
||||||
# bypass - this will bypass cache hit on request (status BYPASS)
|
|
||||||
# but still stores file in cache if cache conditions are met
|
|
||||||
proxy_cache_bypass $cookie_nocache $arg_nocache;
|
|
||||||
|
|
||||||
# no cache - this will ignore cache on request (status MISS)
|
|
||||||
# and does not store file in cache under no condition
|
|
||||||
set_if_empty $nocache "0";
|
|
||||||
|
|
||||||
# map skyd env variable value to "1" for true and "0" for false (expected by proxy_no_cache)
|
# map skyd env variable value to "1" for true and "0" for false (expected by proxy_no_cache)
|
||||||
set_by_lua_block $skyd_disk_cache_enabled {
|
set_by_lua_block $skyd_disk_cache_enabled {
|
||||||
return os.getenv("SKYD_DISK_CACHE_ENABLED") == "true" and "1" or "0"
|
return os.getenv("SKYD_DISK_CACHE_ENABLED") == "true" and "1" or "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# bypass - this will bypass cache hit on request (status BYPASS)
|
||||||
|
# but still stores file in cache if cache conditions are met
|
||||||
|
proxy_cache_bypass $cookie_nocache $arg_nocache $skyd_disk_cache_enabled;
|
||||||
|
|
||||||
|
# no cache - this will ignore cache on request (status MISS)
|
||||||
|
# and does not store file in cache under no condition
|
||||||
|
set_if_empty $nocache "0";
|
||||||
|
|
||||||
# disable cache when nocache is set or skyd cache is enabled
|
# disable cache when nocache is set or skyd cache is enabled
|
||||||
proxy_no_cache $nocache $skyd_disk_cache_enabled;
|
proxy_no_cache $nocache $skyd_disk_cache_enabled;
|
||||||
|
|
Reference in New Issue