replication: Avoid proxying if requested object is a deletemarker (#19656)

Fixes: #19654
This commit is contained in:
Poorna 2024-05-02 13:15:54 -07:00 committed by GitHub
parent 04f92f1291
commit 446c760820
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 15 deletions

View File

@ -488,6 +488,8 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj
reader *GetObjectReader
perr error
)
// avoid proxying if version is a delete marker
if !isErrMethodNotAllowed(err) && !(gr != nil && gr.ObjInfo.DeleteMarker) {
proxytgts := getProxyTargets(ctx, bucket, object, opts)
if !proxytgts.Empty() {
globalReplicationStats.incProxy(bucket, getObjectAPI, false)
@ -505,6 +507,7 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj
gr = reader
}
}
}
if reader == nil || !proxy.Proxy {
// validate if the request indeed was authorized, if it wasn't we need to return "ErrAccessDenied"
// instead of any namespace related error.
@ -1024,7 +1027,7 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
objInfo, err := getObjectInfo(ctx, bucket, object, opts)
var proxy proxyResult
if err != nil {
if err != nil && !objInfo.DeleteMarker && !isErrMethodNotAllowed(err) {
// proxy HEAD to replication target if active-active replication configured on bucket
proxytgts := getProxyTargets(ctx, bucket, object, opts)
if !proxytgts.Empty() {