You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cache immutable URLs and handle outages
1. Changes the blob cache to only cache by digest
2. Adds caching for manifests requested by digest
3. Cache but invalidate immediately (after 1s) mutable requests
4. Use invalidated cache (from 3) if the backend is down or 403 unauthorized
Copy file name to clipboardExpand all lines: nginx.conf
+35-2Lines changed: 35 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -224,15 +224,48 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
224
224
return405"docker-registry-proxy: docker is trying to use v1 API. Either the image does not exist upstream, or you need to configure docker-registry-proxy to authenticate against $host";
225
225
}
226
226
227
-
# for the /v2/..../blobs/.... URIs, do cache, and treat redirects.
227
+
# For blob requests by digest, do cache, and treat redirects.
228
+
location ~ ^/v2/(.*)/blobs/sha256:(.*) {
229
+
proxy_pass https://$targetHost;
230
+
proxy_cache cache;
231
+
proxy_cache_key$uri;
232
+
proxy_intercept_errors on;
233
+
error_page301302307 = @handle_redirects;
234
+
}
235
+
236
+
# For manifest requests by digest, do cache, and treat redirects.
237
+
location ~ ^/v2/(.*)/manifests/sha256:(.*) {
238
+
proxy_pass https://$targetHost;
239
+
proxy_cache cache;
240
+
proxy_cache_key$uri;
241
+
proxy_intercept_errors on;
242
+
error_page301302307 = @handle_redirects;
243
+
}
244
+
245
+
# Cache manifest requests that are not by digest (e.g. tags)
246
+
# Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
0 commit comments