cache registry endpoint for 30s

This commit is contained in:
Karol Wypchlo 2021-01-28 14:25:38 +01:00
parent 879fb33d3d
commit 1177b7cf94
2 changed files with 8 additions and 0 deletions

View File

@ -253,6 +253,7 @@ server {
location /skynet/registry {
include /etc/nginx/conf.d/include/cors;
include /etc/nginx/conf.d/include/sia-auth;
include /etc/nginx/conf.d/include/proxy-cache-registry;
limit_req zone=registry_access_by_ip burst=600 nodelay;
limit_req zone=registry_access_by_ip_throttled burst=200 nodelay;

View File

@ -0,0 +1,7 @@
proxy_cache skynet;
proxy_http_version 1.1; # upgrade if necessary
proxy_cache_key publickey=$arg_publickey&datakey=$arg_datakey; # cache based on publickey and datakey
proxy_cache_valid 200 30s; # cache only 200 responses and only for 30 seconds
proxy_cache_lock on; # queue cache requests for the same resource until it is fully cached
proxy_cache_bypass $cookie_nocache $arg_nocache; # add cache bypass option
add_header X-Proxy-Cache $upstream_cache_status; # add response header to indicate cache hits and misses