mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-02 21:11:37 +01:00
Return 403 when trying to push artifacts into the proxy cache project to avoid the retrying in the docker client
Return 403 when trying to push artifacts into the proxy cache project to avoid the retrying in the docker client fixes #12731 Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
3b7a2e11b4
commit
a73742c0a7
@ -184,7 +184,7 @@ func DisableBlobAndManifestUploadMiddleware() func(http.Handler) http.Handler {
|
||||
}
|
||||
if isProxyProject(p) && !isProxySession(ctx) {
|
||||
httpLib.SendError(w,
|
||||
errors.MethodNotAllowedError(
|
||||
errors.DeniedError(
|
||||
errors.Errorf("can not push artifact to a proxy project: %v", p.Name)))
|
||||
return
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ func RegisterRoutes() {
|
||||
root.NewRoute().
|
||||
Method(http.MethodPost).
|
||||
Path("/*/blobs/uploads").
|
||||
Middleware(repoproxy.DisableBlobAndManifestUploadMiddleware()).
|
||||
Middleware(quota.PostInitiateBlobUploadMiddleware()).
|
||||
Middleware(blob.PostInitiateBlobUploadMiddleware()).
|
||||
Handler(proxy)
|
||||
@ -84,13 +85,11 @@ func RegisterRoutes() {
|
||||
root.NewRoute().
|
||||
Method(http.MethodPatch).
|
||||
Path("/*/blobs/uploads/:session_id").
|
||||
Middleware(repoproxy.DisableBlobAndManifestUploadMiddleware()).
|
||||
Middleware(blob.PatchBlobUploadMiddleware()).
|
||||
Handler(proxy)
|
||||
root.NewRoute().
|
||||
Method(http.MethodPut).
|
||||
Path("/*/blobs/uploads/:session_id").
|
||||
Middleware(repoproxy.DisableBlobAndManifestUploadMiddleware()).
|
||||
Middleware(quota.PutBlobUploadMiddleware()).
|
||||
Middleware(blob.PutBlobUploadMiddleware()).
|
||||
Handler(proxy)
|
||||
|
Loading…
Reference in New Issue
Block a user