From fee860bc7a6fdadc818cdf77f4dfdf1bb53314c7 Mon Sep 17 00:00:00 2001 From: Scott Lampert Date: Wed, 30 Jun 2021 16:31:37 -0600 Subject: [PATCH] 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. --- server/service/validation_setup.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/service/validation_setup.go b/server/service/validation_setup.go index 45148f4728..2eac700fcf 100644 --- a/server/service/validation_setup.go +++ b/server/service/validation_setup.go @@ -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 }