From b0e7f435c896bddfc7ebfa594cbf65095e008bf5 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 29 Jul 2015 23:41:34 -0700 Subject: [PATCH] Support virtual host styled requests, convert them to path style properly --- pkg/client/s3/s3.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/client/s3/s3.go b/pkg/client/s3/s3.go index d9c66ae7..e8cbc97f 100644 --- a/pkg/client/s3/s3.go +++ b/pkg/client/s3/s3.go @@ -61,6 +61,13 @@ func New(config *Config) (client.Client, error) { if err != nil { return nil, iodine.New(err, nil) } + // convert any virtual host styled requests + match, _ := filepath.Match("*.s3*.amazonaws.com", u.Host) + if match { + hostSplits := strings.SplitN(u.Host, ".", 2) + u.Path = hostSplits[0] + u.Host = hostSplits[1] + } var transport http.RoundTripper switch { case config.Debug == true: