diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index dc75459ee..171d7e90d 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -2226,7 +2226,7 @@ func getProxyTargets(ctx context.Context, bucket, object string, opts ObjectOpti if opts.VersionSuspended { return &madmin.BucketTargets{} } - if opts.ProxyRequest { + if opts.ProxyRequest || (opts.ProxyHeaderSet && !opts.ProxyRequest) { return &madmin.BucketTargets{} } cfg, err := getReplicationConfig(ctx, bucket) @@ -2247,7 +2247,7 @@ func getProxyTargets(ctx context.Context, bucket, object string, opts ObjectOpti func proxyHeadToRepTarget(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, opts ObjectOptions, proxyTargets *madmin.BucketTargets) (tgt *TargetClient, oi ObjectInfo, proxy proxyResult) { // this option is set when active-active replication is in place between site A -> B, // and site B does not have the object yet. - if opts.ProxyRequest { // true only when site B sets MinIOSourceProxyRequest header + if opts.ProxyRequest || (opts.ProxyHeaderSet && !opts.ProxyRequest) { // true only when site B sets MinIOSourceProxyRequest header return nil, oi, proxy } var perr error @@ -2372,7 +2372,7 @@ func scheduleReplication(ctx context.Context, oi ObjectInfo, o ObjectLayer, dsc func proxyTaggingToRepTarget(ctx context.Context, bucket, object string, tags *tags.Tags, opts ObjectOptions, proxyTargets *madmin.BucketTargets) (proxy proxyResult) { // this option is set when active-active replication is in place between site A -> B, // and request hits site B that does not have the object yet. - if opts.ProxyRequest { // true only when site B sets MinIOSourceProxyRequest header + if opts.ProxyRequest || (opts.ProxyHeaderSet && !opts.ProxyRequest) { // true only when site B sets MinIOSourceProxyRequest header return proxy } var wg sync.WaitGroup @@ -2440,7 +2440,7 @@ func proxyTaggingToRepTarget(ctx context.Context, bucket, object string, tags *t func proxyGetTaggingToRepTarget(ctx context.Context, bucket, object string, opts ObjectOptions, proxyTargets *madmin.BucketTargets) (tgs *tags.Tags, proxy proxyResult) { // this option is set when active-active replication is in place between site A -> B, // and request hits site B that does not have the object yet. - if opts.ProxyRequest { // true only when site B sets MinIOSourceProxyRequest header + if opts.ProxyRequest || (opts.ProxyHeaderSet && !opts.ProxyRequest) { // true only when site B sets MinIOSourceProxyRequest header return nil, proxy } var wg sync.WaitGroup diff --git a/cmd/object-api-interface.go b/cmd/object-api-interface.go index c9ab70f40..0f24c9833 100644 --- a/cmd/object-api-interface.go +++ b/cmd/object-api-interface.go @@ -90,6 +90,7 @@ type ObjectOptions struct { PreserveETag string // preserves this etag during a PUT call. NoLock bool // indicates to lower layers if the caller is expecting to hold locks. ProxyRequest bool // only set for GET/HEAD in active-active replication scenario + ProxyHeaderSet bool // only set for GET/HEAD in active-active replication scenario ReplicationRequest bool // true only if replication request ReplicationSourceTaggingTimestamp time.Time // set if MinIOSourceTaggingTimestamp received ReplicationSourceLegalholdTimestamp time.Time // set if MinIOSourceObjectLegalholdTimestamp received diff --git a/cmd/object-api-options.go b/cmd/object-api-options.go index 7c32fec18..08c64bb81 100644 --- a/cmd/object-api-options.go +++ b/cmd/object-api-options.go @@ -66,8 +66,13 @@ func getDefaultOpts(header http.Header, copySource bool, metadata map[string]str if crypto.S3.IsRequested(header) || (metadata != nil && crypto.S3.IsEncrypted(metadata)) { opts.ServerSideEncryption = encrypt.NewSSE() } - _, opts.ProxyRequest = header[xhttp.MinIOSourceProxyRequest] - _, opts.ReplicationRequest = header[xhttp.MinIOSourceReplicationRequest] + if v, ok := header[xhttp.MinIOSourceProxyRequest]; ok { + opts.ProxyHeaderSet = true + opts.ProxyRequest = strings.Join(v, "") == "true" + } + if _, ok := header[xhttp.MinIOSourceReplicationRequest]; ok { + opts.ReplicationRequest = true + } opts.Speedtest = header.Get(globalObjectPerfUserMetadata) != "" return }