mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 18:27:40 +00:00
Merge pull request #15025 from stonezdj/2.2_fall_back_local
(cherry-pick) Fall back to local registry when upstream registry is not working
This commit is contained in:
commit
e579545f89
|
@ -97,7 +97,12 @@ func preCheck(ctx context.Context) (art lib.ArtifactInfo, p *models.Project, ctl
|
|||
func ManifestMiddleware() func(http.Handler) http.Handler {
|
||||
return middleware.New(func(w http.ResponseWriter, r *http.Request, next http.Handler) {
|
||||
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