Skip to content

Commit 3c91b09

Browse files
nekrondevHeiko Besemann
and
Heiko Besemann
authored
minio: add missing region on client initialization (#26412)
The MinIO client isn't redirecting to the correct AWS endpoint if a non-default data center is used. In my use case I created an AWS bucket at `eu-central-1` region. Because of the missing region initialization of the client the default `us-east-1` API endpoint is used returning a `301 Moved Permanently` response that's not handled properly by MinIO client. This in return aborts using S3 storage on AWS as the `BucketExists()` call will fail with the http moved error. MinIO client trace shows the issue: ```text ---------START-HTTP--------- HEAD / HTTP/1.1 Host: xxxxxxxxxxx-prod-gitea-data.s3.dualstack.us-east-1.amazonaws.com User-Agent: MinIO (windows; amd64) minio-go/v7.0.61 Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20230809/accesspoint.eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED** X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 X-Amz-Date: 20230809T141143Z HTTP/1.1 301 Moved Permanently Connection: close Content-Type: application/xml Date: Wed, 09 Aug 2023 14:11:43 GMT Server: AmazonS3 X-Amz-Bucket-Region: eu-central-1 X-Amz-Id-2: UK7wfeYi0HcTcytNvQ3wTAZ5ZP1mOSMnvRZ9Fz4xXzeNsS47NB/KfFx2unFxo3L7XckHpMNPPVo= X-Amz-Request-Id: S1V2MJV8SZ11GEVN ---------END-HTTP--------- ``` Co-authored-by: Heiko Besemann <heiko.besemann@qbeyond.de>
1 parent e7cbb0e commit 3c91b09

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/storage/minio.go

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
8484
Creds: credentials.NewStaticV4(config.AccessKeyID, config.SecretAccessKey, ""),
8585
Secure: config.UseSSL,
8686
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}},
87+
Region: config.Location,
8788
})
8889
if err != nil {
8990
return nil, convertMinioErr(err)

0 commit comments

Comments
 (0)