File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ echo -n "" >/etc/nginx/nginx.manifest.caching.config.conf
115115 # First tier caching of manifests; configure via MANIFEST_CACHE_PRIMARY_REGEX and MANIFEST_CACHE_PRIMARY_TIME
116116 location ~ ^/v2/(.*)/manifests/${MANIFEST_CACHE_PRIMARY_REGEX} {
117117 set \$ docker_proxy_request_type "manifest-primary";
118+ set \$ cache_key \$ uri;
118119 proxy_cache_valid ${MANIFEST_CACHE_PRIMARY_TIME} ;
119120 include "/etc/nginx/nginx.manifest.stale.conf";
120121 }
124125 # Secondary tier caching of manifests; configure via MANIFEST_CACHE_SECONDARY_REGEX and MANIFEST_CACHE_SECONDARY_TIME
125126 location ~ ^/v2/(.*)/manifests/${MANIFEST_CACHE_SECONDARY_REGEX} {
126127 set \$ docker_proxy_request_type "manifest-secondary";
128+ set \$ cache_key \$ uri;
127129 proxy_cache_valid ${MANIFEST_CACHE_SECONDARY_TIME} ;
128130 include "/etc/nginx/nginx.manifest.stale.conf";
129131 }
133135 # Default tier caching for manifests. Caches for ${MANIFEST_CACHE_DEFAULT_TIME} (from MANIFEST_CACHE_DEFAULT_TIME)
134136 location ~ ^/v2/(.*)/manifests/ {
135137 set \$ docker_proxy_request_type "manifest-default";
138+ set \$ cache_key \$ uri;
136139 proxy_cache_valid ${MANIFEST_CACHE_DEFAULT_TIME} ;
137140 include "/etc/nginx/nginx.manifest.stale.conf";
138141 }
142145 # Manifest caching is disabled. Enable it with ENABLE_MANIFEST_CACHE=true
143146 location ~ ^/v2/(.*)/manifests/ {
144147 set \$ docker_proxy_request_type "manifest-default-disabled";
148+ set \$ cache_key \$ uri;
145149 proxy_cache_valid 0s;
146150 include "/etc/nginx/nginx.manifest.stale.conf";
147151 }
Original file line number Diff line number Diff line change @@ -266,13 +266,15 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
266266 # For blob requests by digest, do cache, and treat redirects.
267267 location ~ ^/v2/( .*) /blobs/sha256:( .*) {
268268 set $docker_proxy_request_type "blob-by-digest" ;
269+ set $cache_key $2 ;
269270 include "/etc/nginx/nginx.manifest.common.conf" ;
270271 }
271272
272273 # For manifest requests by digest, do cache, and treat redirects.
273274 # These are some of the requests that DockerHub will throttle.
274275 location ~ ^/v2/( .*) /manifests/sha256:( .*) {
275276 set $docker_proxy_request_type "manifest-by-digest" ;
277+ set $cache_key $uri ;
276278 include "/etc/nginx/nginx.manifest.common.conf" ;
277279 }
278280
@@ -285,6 +287,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
285287 # Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
286288 location ~ ^/v2/( .*) /blobs/ {
287289 set $docker_proxy_request_type "blob-mutable" ;
290+ set $cache_key $uri ;
288291 proxy_cache_valid 0s ;
289292 include "/etc/nginx/nginx.manifest.stale.conf" ;
290293 }
Original file line number Diff line number Diff line change 33 add_header X-Docker-Registry-Proxy-Cache-Type "$docker_proxy_request_type";
44 proxy_pass https://$targetHost;
55 proxy_cache cache;
6- proxy_cache_key $uri ;
6+ proxy_cache_key $cache_key ;
77 proxy_intercept_errors on;
88 error_page 301 302 307 = @handle_redirects;
You can’t perform that action at this time.
0 commit comments