diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 8376067d..b2bb8d2d 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -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; diff --git a/docker/nginx/conf.d/include/proxy-cache-registry b/docker/nginx/conf.d/include/proxy-cache-registry new file mode 100644 index 00000000..cc4a61c0 --- /dev/null +++ b/docker/nginx/conf.d/include/proxy-cache-registry @@ -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