@ -411,10 +411,30 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
gr , err := getObjectNInfo ( ctx , bucket , object , rs , r . Header , readLock , opts )
gr , err := getObjectNInfo ( ctx , bucket , object , rs , r . Header , readLock , opts )
if err != nil {
if err != nil {
var (
reader * GetObjectReader
proxy bool
)
if isProxyable ( ctx , bucket ) {
// proxy to replication target if active-active replication is in place.
reader , proxy = proxyGetToReplicationTarget ( ctx , bucket , object , rs , r . Header , opts )
if reader != nil && proxy {
gr = reader
}
}
if reader == nil || ! proxy {
if isErrPreconditionFailed ( err ) {
if isErrPreconditionFailed ( err ) {
return
return
}
}
if globalBucketVersioningSys . Enabled ( bucket ) && gr != nil {
if globalBucketVersioningSys . Enabled ( bucket ) && gr != nil {
if ! gr . ObjInfo . VersionPurgeStatus . Empty ( ) {
// Shows the replication status of a permanent delete of a version
w . Header ( ) [ xhttp . MinIODeleteReplicationStatus ] = [ ] string { string ( gr . ObjInfo . VersionPurgeStatus ) }
}
if ! gr . ObjInfo . ReplicationStatus . Empty ( ) && gr . ObjInfo . DeleteMarker {
w . Header ( ) [ xhttp . MinIODeleteMarkerReplicationStatus ] = [ ] string { string ( gr . ObjInfo . ReplicationStatus ) }
}
// Versioning enabled quite possibly object is deleted might be delete-marker
// Versioning enabled quite possibly object is deleted might be delete-marker
// if present set the headers, no idea why AWS S3 sets these headers.
// if present set the headers, no idea why AWS S3 sets these headers.
if gr . ObjInfo . VersionID != "" && gr . ObjInfo . DeleteMarker {
if gr . ObjInfo . VersionID != "" && gr . ObjInfo . DeleteMarker {
@ -425,6 +445,7 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
writeErrorResponse ( ctx , w , toAPIError ( ctx , err ) , r . URL , guessIsBrowserReq ( r ) )
writeErrorResponse ( ctx , w , toAPIError ( ctx , err ) , r . URL , guessIsBrowserReq ( r ) )
return
return
}
}
}
defer gr . Close ( )
defer gr . Close ( )
objInfo := gr . ObjInfo
objInfo := gr . ObjInfo
@ -577,6 +598,19 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
objInfo , err := getObjectInfo ( ctx , bucket , object , opts )
objInfo , err := getObjectInfo ( ctx , bucket , object , opts )
if err != nil {
if err != nil {
var (
proxy bool
perr error
oi ObjectInfo
)
// proxy HEAD to replication target if active-active replication configured on bucket
if isProxyable ( ctx , bucket ) {
oi , proxy , perr = proxyHeadToReplicationTarget ( ctx , bucket , object , opts )
if proxy && perr == nil {
objInfo = oi
}
}
if ! proxy || perr != nil {
if globalBucketVersioningSys . Enabled ( bucket ) {
if globalBucketVersioningSys . Enabled ( bucket ) {
if ! objInfo . VersionPurgeStatus . Empty ( ) {
if ! objInfo . VersionPurgeStatus . Empty ( ) {
// Shows the replication status of a permanent delete of a version
// Shows the replication status of a permanent delete of a version
@ -595,6 +629,7 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
writeErrorResponseHeadersOnly ( w , toAPIError ( ctx , err ) )
writeErrorResponseHeadersOnly ( w , toAPIError ( ctx , err ) )
return
return
}
}
}
// Automatically remove the object/version is an expiry lifecycle rule can be applied
// Automatically remove the object/version is an expiry lifecycle rule can be applied
if lc , err := globalLifecycleSys . Get ( bucket ) ; err == nil {
if lc , err := globalLifecycleSys . Get ( bucket ) ; err == nil {