Skip to content

Commit b270577

Browse files
fix(nginx): regex
1 parent 800309e commit b270577

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

nginx.conf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,14 @@ http {
239239
}
240240

241241
# For blob requests by digest, do cache, and treat redirects.
242-
#location ~ ^/v2/(.*)/blobs/sha256:(.*) {
243-
location ~ ^/v2/([\w\-]+(?:(?:\/[\w\-]+)+|(?:[\w\-]+)+))/blobs/sha256:([0-9a-f]+) {
242+
location ~ ^\/v2\/([\w\-]+\/)+blobs\/sha256:([0-9a-f]+) {
244243
set $docker_proxy_request_type "blob-by-digest";
245244
include "/opt/openresty/nginx/conf/nginx.manifest.common.conf";
246245
}
247246

248247
# For manifest requests by digest, do cache, and treat redirects.
249248
# These are some of the requests that DockerHub will throttle.
250-
#location ~ ^/v2/(.*)/manifests/sha256:([0-9a-f])*(.*) {
251-
location ~ ^/v2/([\w\-]+(?:(?:\/[\w\-]+)+|(?:[\w\-]+)+))/manifests/sha256:([0-9a-f]+) {
249+
location ~ ^\/v2\/([\w\-]+\/)+manifests\/sha256:([0-9a-f]+) {
252250
set $docker_proxy_request_type "manifest-by-digest";
253251
include "/opt/openresty/nginx/conf/nginx.manifest.common.conf";
254252
}
@@ -260,7 +258,7 @@ http {
260258

261259
# Cache blobs requests that are not by digest
262260
# Since these are mutable, we invalidate them immediately and keep them only in case the backend is down
263-
location ~ ^/v2/([\w\-]+(?:(?:\/[\w\-]+)+|(?:[\w\-]+)+))/blobs/ {
261+
location ~ ^\/v2\/([\w\-]+\/)+blobs\/ {
264262
set $docker_proxy_request_type "blob-mutable";
265263
proxy_cache_valid 0s;
266264
include "/opt/openresty/nginx/conf/nginx.manifest.stale.conf";

0 commit comments

Comments
 (0)