diff --git a/server/service/client.go b/server/service/client.go index 495ea5c115..587d146374 100644 --- a/server/service/client.go +++ b/server/service/client.go @@ -36,15 +36,15 @@ type ClientOption func(*Client) error func NewClient(addr string, insecureSkipVerify bool, rootCA, urlPrefix string, options ...ClientOption) (*Client, error) { // TODO #265 refactor all optional parameters to functional options // API breaking change, needs a major version release - if !strings.HasPrefix(addr, "https://") { - return nil, errors.New("Address must start with https://") - } - baseURL, err := url.Parse(addr) if err != nil { return nil, errors.Wrap(err, "parsing URL") } + if baseURL.Scheme != "https" && !strings.Contains(baseURL.Host, "localhost") { + return nil, errors.New("address must start with https:// for remote connections") + } + rootCAPool := x509.NewCertPool() if rootCA != "" { // read in the root cert file specified in the context