From 54ff39150ed0e521d9b0eab29cde4b8a10998834 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 17 Apr 2023 14:35:21 +0100 Subject: [PATCH] GetBucketLocation: Use vhost signature in case of v2 signature The existing code always picks a path style signature when v2 mode is selected. Reviewing the history shows little information why it is done that way. A previous recent commit, 24cdd7fc940230d35edf1a4d4824c0e7b5a02828, though it seems correct, broke existing deployments that use GCS (e.g. https://github.com/minio/mc/issues/4547) We should not sign v2 with path style when the endpoint is vhost. This commit is tested with MinIO/AWS/GCS when v2 is enabled. --- bucket-cache.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bucket-cache.go b/bucket-cache.go index 9df0a31057..3745ce34cf 100644 --- a/bucket-cache.go +++ b/bucket-cache.go @@ -240,9 +240,7 @@ func (c *Client) getBucketLocationRequest(ctx context.Context, bucketName string } if signerType.IsV2() { - // Get Bucket Location calls should be always path style - isVirtualHost := false - req = signer.SignV2(*req, accessKeyID, secretAccessKey, isVirtualHost) + req = signer.SignV2(*req, accessKeyID, secretAccessKey, isVirtualStyle) return req, nil }