From 00555c747ec5168949d7b1b0a11f90e952d933d6 Mon Sep 17 00:00:00 2001 From: poornas Date: Thu, 17 Sep 2020 11:09:50 -0700 Subject: [PATCH] Strip standard ports off remote target url (#10498) --- pkg/madmin/remote-target-commands.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/madmin/remote-target-commands.go b/pkg/madmin/remote-target-commands.go index 61993d765..9b9280817 100644 --- a/pkg/madmin/remote-target-commands.go +++ b/pkg/madmin/remote-target-commands.go @@ -118,7 +118,15 @@ func (t BucketTarget) URL() string { if t.Secure { scheme = "https" } - return fmt.Sprintf("%s://%s", scheme, t.Endpoint) + urlStr := fmt.Sprintf("%s://%s", scheme, t.Endpoint) + u, err := url.Parse(urlStr) + if err != nil { + return urlStr + } + if u.Port() == "80" || u.Port() == "443" { + u.Host = u.Hostname() + } + return u.String() } // Empty returns true if struct is empty.