mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 19:56:09 +01:00
Merge pull request #14949 from stonezdj/21may22_fallback_localregistry
Fall back to local registry when upstream registry is not working
This commit is contained in:
commit
4ed5fee681
@ -95,7 +95,12 @@ func preCheck(ctx context.Context) (art lib.ArtifactInfo, p *proModels.Project,
|
|||||||
func ManifestMiddleware() func(http.Handler) http.Handler {
|
func ManifestMiddleware() func(http.Handler) http.Handler {
|
||||||
return middleware.New(func(w http.ResponseWriter, r *http.Request, next http.Handler) {
|
return middleware.New(func(w http.ResponseWriter, r *http.Request, next http.Handler) {
|
||||||
if err := handleManifest(w, r, next); err != nil {
|
if err := handleManifest(w, r, next); err != nil {
|
||||||
httpLib.SendError(w, err)
|
if errors.IsNotFoundErr(err) {
|
||||||
|
httpLib.SendError(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Errorf("failed to proxy manifest, fallback to local, request uri: %v, error: %v", r.RequestURI, err)
|
||||||
|
next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user