@ -27,6 +27,7 @@ import (
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/bucket/policy"
"github.com/minio/minio/pkg/handlers"
"github.com/minio/minio/pkg/sync/errgroup"
"github.com/minio/minio/pkg/sync/errgroup"
)
)
@ -113,7 +114,12 @@ func (api objectAPIHandlers) ListObjectVersionsHandler(w http.ResponseWriter, r
return
return
}
}
if proxyRequestByBucket ( ctx , w , r , bucket ) {
// Forward the request using Source IP or bucket
forwardStr := handlers . GetSourceIPFromHeaders ( r )
if forwardStr == "" {
forwardStr = bucket
}
if proxyRequestByStringHash ( ctx , w , r , forwardStr ) {
return
return
}
}
@ -340,8 +346,8 @@ func proxyRequestByNodeIndex(ctx context.Context, w http.ResponseWriter, r *http
return proxyRequest ( ctx , w , r , ep )
return proxyRequest ( ctx , w , r , ep )
}
}
func proxyRequestByBucket ( ctx context . Context , w http . ResponseWriter , r * http . Request , bucket string ) ( success bool ) {
func proxyRequestByStringHash ( ctx context . Context , w http . ResponseWriter , r * http . Request , str string ) ( success bool ) {
return proxyRequestByNodeIndex ( ctx , w , r , crcHashMod ( bucket , len ( globalProxyEndpoints ) ) )
return proxyRequestByNodeIndex ( ctx , w , r , crcHashMod ( str , len ( globalProxyEndpoints ) ) )
}
}
// ListObjectsV1Handler - GET Bucket (List Objects) Version 1.
// ListObjectsV1Handler - GET Bucket (List Objects) Version 1.
@ -382,7 +388,12 @@ func (api objectAPIHandlers) ListObjectsV1Handler(w http.ResponseWriter, r *http
return
return
}
}
if proxyRequestByBucket ( ctx , w , r , bucket ) {
// Forward the request using Source IP or bucket
forwardStr := handlers . GetSourceIPFromHeaders ( r )
if forwardStr == "" {
forwardStr = bucket
}
if proxyRequestByStringHash ( ctx , w , r , forwardStr ) {
return
return
}
}