Fix fleetctl setup requiring https for localhost (#1270)

This fixes a reversion with fleetctl setup that requires https even for localhost connections. This was previously fixed in #489.
This commit is contained in:
Scott Lampert
2021-06-30 15:31:37 -07:00
committed by GitHub
parent 6649d08a05
commit fee860bc7a
+4 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"net/url"
"strings"
"github.com/fleetdm/fleet/v4/server/fleet"
)
@@ -31,8 +32,10 @@ func validateServerURL(urlString string) error {
if err != nil {
return err
}
if serverURL.Scheme != "https" {
if serverURL.Scheme != "https" && !strings.Contains(serverURL.Host, "localhost") {
return errors.New("url scheme must be https")
}
return nil
}