add request method and upstream time to logging; add cache status header; helps investigate #54

pull/56/head
Ricardo Pardini 2020-10-30 00:14:29 +01:00
parent 78f96ffe92
commit ffc7540f43
1 changed files with 16 additions and 10 deletions

View File

@ -62,9 +62,11 @@ http {
'{'
'"access_time":"$time_local",'
'"upstream_cache_status":"$upstream_cache_status",'
'"method":"$request_method",'
'"uri":"$uri",'
'"status":"$status",'
'"bytes_sent":"$body_bytes_sent",'
'"upstream_response_time":"$upstream_response_time",'
'"host":"$host",'
'"proxy_host":"$proxy_host",'
'"upstream":"$upstream_addr"'
@ -199,6 +201,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
# Do some tweaked logging.
access_log /var/log/nginx/access.log tweaked;
# Send upstream status as header
add_header X-Docker-Registry-Proxy-Cache-Upstream-Status "$upstream_cache_status";
# Use the generated certificates, they contain names for all the proxied registries.
ssl_certificate /certs/fullchain.pem;
ssl_certificate_key /certs/web.key;
@ -265,6 +270,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
}
# For manifest requests by digest, do cache, and treat redirects.
# These are some of the requests that DockerHub will throttle.
location ~ ^/v2/(.*)/manifests/sha256:(.*) {
proxy_pass https://$targetHost;
proxy_cache cache;
@ -275,6 +281,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
# Cache manifest requests that are not by digest (e.g. tags)
# Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
# These are some of the requests that DockerHub will throttle.
location ~ ^/v2/(.*)/manifests/ {
proxy_pass https://$targetHost;
proxy_cache cache;
@ -322,7 +329,6 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
location / {
proxy_pass https://$targetHost;
proxy_cache off;
add_header X-Docker-Caching-Proxy-Debug-Cache "no:default";
}
}
}