6464 '"upstream_cache_status":"$upstream_cache_status",'
6565 '"method":"$request_method",'
6666 '"uri":"$uri",'
67+ '"request_type":"$docker_proxy_request_type",'
6768 '"status":"$status",'
6869 '"bytes_sent":"$body_bytes_sent",'
6970 '"upstream_response_time":"$upstream_response_time",'
@@ -135,6 +136,7 @@ http {
135136 # dont log the CONNECT proxy.
136137 #access_log /var/log/nginx/access.log debug_proxy;
137138 access_log off;
139+ set $docker_proxy_request_type "unknown-connect" ;
138140
139141 proxy_connect;
140142 proxy_connect_address $interceptedHost ;
@@ -201,6 +203,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
201203
202204 # Do some tweaked logging.
203205 access_log /var/log/nginx/access.log tweaked;
206+ set $docker_proxy_request_type "unknown" ;
204207
205208 # Send upstream status as header
206209 add_header X-Docker-Registry-Proxy-Cache-Upstream-Status "$upstream_cache_status" ;
@@ -263,6 +266,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
263266
264267 # For blob requests by digest, do cache, and treat redirects.
265268 location ~ ^/v2/( .*) /blobs/sha256:( .*) {
269+ set $docker_proxy_request_type "blob-by-digest" ;
270+ add_header X-Docker-Registry-Proxy-Cache-Upstream-Status "$upstream_cache_status" ;
271+ add_header X-Docker-Registry-Proxy-Cache-Type "$docker_proxy_request_type" ;
266272 proxy_pass https://$targetHost ;
267273 proxy_cache cache;
268274 proxy_cache_key $uri ;
@@ -273,6 +279,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
273279 # For manifest requests by digest, do cache, and treat redirects.
274280 # These are some of the requests that DockerHub will throttle.
275281 location ~ ^/v2/( .*) /manifests/sha256:( .*) {
282+ set $docker_proxy_request_type "manifest-by-digest" ;
283+ add_header X-Docker-Registry-Proxy-Cache-Upstream-Status "$upstream_cache_status" ;
284+ add_header X-Docker-Registry-Proxy-Cache-Type "$docker_proxy_request_type" ;
276285 proxy_pass https://$targetHost ;
277286 proxy_cache cache;
278287 proxy_cache_key $uri ;
@@ -284,6 +293,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
284293 # Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
285294 # These are some of the requests that DockerHub will throttle.
286295 location ~ ^/v2/( .*) /manifests/ {
296+ set $docker_proxy_request_type "manifest-mutable" ;
297+ add_header X-Docker-Registry-Proxy-Cache-Upstream-Status "$upstream_cache_status" ;
298+ add_header X-Docker-Registry-Proxy-Cache-Type "$docker_proxy_request_type" ;
287299 proxy_pass https://$targetHost ;
288300 proxy_cache cache;
289301 proxy_cache_key $uri ;
@@ -296,6 +308,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
296308 # Cache blobs requests that are not by digest
297309 # Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
298310 location ~ ^/v2/( .*) /blobs/ {
311+ set $docker_proxy_request_type "blob-mutable" ;
312+ add_header X-Docker-Registry-Proxy-Cache-Upstream-Status "$upstream_cache_status" ;
313+ add_header X-Docker-Registry-Proxy-Cache-Type "$docker_proxy_request_type" ;
299314 proxy_pass https://$targetHost ;
300315 proxy_cache cache;
301316 proxy_cache_key $uri ;
0 commit comments