@@ -252,6 +252,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
252
252
proxy_ignore_client_abort on ;
253
253
proxy_cache_revalidate on;
254
254
255
+ # Avoid conversion of HEAD method to GET
256
+ proxy_cache_convert_head off;
257
+
255
258
# Hide/ignore headers from caching. S3 especially likes to send Expires headers in the past in some situations.
256
259
proxy_hide_header Set-Cookie;
257
260
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
@@ -275,15 +278,15 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
275
278
# For blob requests by digest, do cache, and treat redirects.
276
279
location ~ ^/v2/(.*)/blobs/sha256:(.*) {
277
280
set $docker_proxy_request_type "blob-by-digest" ;
278
- set $cache_key $2 ;
281
+ set $cache_key $request_method$ 2 ;
279
282
include "/etc/nginx/nginx.manifest.common.conf" ;
280
283
}
281
284
282
285
# For manifest requests by digest, do cache, and treat redirects.
283
286
# These are some of the requests that DockerHub will throttle.
284
287
location ~ ^/v2/(.*)/manifests/sha256:(.*) {
285
288
set $docker_proxy_request_type "manifest-by-digest" ;
286
- set $cache_key $uri ;
289
+ set $cache_key $request_method$ uri ;
287
290
include "/etc/nginx/nginx.manifest.common.conf" ;
288
291
}
289
292
@@ -296,7 +299,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
296
299
# Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
297
300
location ~ ^/v2/(.*)/blobs/ {
298
301
set $docker_proxy_request_type "blob-mutable" ;
299
- set $cache_key $uri ;
302
+ set $cache_key $request_method$ uri ;
300
303
proxy_cache_valid 0s ;
301
304
include "/etc/nginx/nginx.manifest.stale.conf" ;
302
305
}
@@ -307,6 +310,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
307
310
# the proxy_* directives, these will disappear
308
311
set $original_uri $uri ;
309
312
set $orig_loc $upstream_http_location ;
313
+ set $orig_cache_key $cache_key
310
314
# Handle relative re-direct in Location header (as opposed to absolute)
311
315
if ($upstream_http_location !~ "^http" ) {
312
316
set $orig_loc "${scheme}://${host}${upstream_http_location}" ;
@@ -322,7 +326,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
322
326
proxy_cache $cache ;
323
327
# But we store the result with the cache key of the original request URI
324
328
# so that future clients don't need to follow the redirect too
325
- proxy_cache_key $original_uri $slice_range ;
329
+ proxy_cache_key $orig_cache_key $slice_range ;
326
330
}
327
331
328
332
# by default, dont cache anything.
0 commit comments