From 831de8fa36cbc8889dacd007c0793ca23bba0a55 Mon Sep 17 00:00:00 2001 From: kahirokunn Date: Wed, 8 May 2024 10:07:26 +0900 Subject: [PATCH] feat: enable specifying harbor as remote domain in REGISTRY_PROXY_REMOTEDOMAIN https://github.com/distribution/distribution/discussions/4340 Signed-off-by: kahirokunn --- registry/proxy/proxyregistry.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/proxy/proxyregistry.go b/registry/proxy/proxyregistry.go index 33dcc4afa..c5c2954ca 100644 --- a/registry/proxy/proxyregistry.go +++ b/registry/proxy/proxyregistry.go @@ -239,7 +239,9 @@ func (r *remoteAuthChallenger) tryEstablishChallenges(ctx context.Context) error defer r.Unlock() remoteURL := r.remoteURL - remoteURL.Path = "/v2/" + if remoteURL.Path == "" || remoteURL.Path == "/" { + remoteURL.Path = "/v2/" + } challenges, err := r.cm.GetChallenges(remoteURL) if err != nil { return err