diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go index 93021fc41..d4aa1d08d 100644 --- a/clientapi/routing/routing.go +++ b/clientapi/routing/routing.go @@ -129,10 +129,6 @@ func Setup( })).Methods(http.MethodGet, http.MethodOptions) } - if !strings.HasPrefix(string(cfg.Matrix.ServerName), "http://") || !strings.HasPrefix(string(cfg.Matrix.ServerName), "https://") { - logrus.Warn("The well_known_server_name does not start with http:// or https:// does not start with 'http://' or 'https://'. Some clients may fail to connect.") - } - publicAPIMux.Handle("/versions", httputil.MakeExternalAPI("versions", func(req *http.Request) util.JSONResponse { return util.JSONResponse{ diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go index 59b80307b..dc7a363e7 100644 --- a/federationapi/routing/routing.go +++ b/federationapi/routing/routing.go @@ -18,7 +18,6 @@ import ( "context" "fmt" "net/http" - "strings" "sync" "time" @@ -124,10 +123,6 @@ func Setup( ).Methods(http.MethodGet, http.MethodOptions) } - if !strings.HasPrefix(string(cfg.Matrix.ServerName), "http://") || !strings.HasPrefix(string(cfg.Matrix.ServerName), "https://") { - logrus.Warn("The well_known_server_name does not start with http:// or https:// does not start with 'http://' or 'https://'. Some clients may fail to connect.") - } - // Ignore the {keyID} argument as we only have a single server key so we always // return that key. // Even if we had more than one server key, we would probably still ignore the diff --git a/setup/config/config_global.go b/setup/config/config_global.go index 5b4ccf400..a5444d570 100644 --- a/setup/config/config_global.go +++ b/setup/config/config_global.go @@ -10,6 +10,7 @@ import ( "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/fclient" "github.com/matrix-org/gomatrixserverlib/spec" + "github.com/sirupsen/logrus" "golang.org/x/crypto/ed25519" ) @@ -114,6 +115,11 @@ func (c *Global) Verify(configErrs *ConfigErrors) { checkNotEmpty(configErrs, "global.server_name", string(c.ServerName)) checkNotEmpty(configErrs, "global.private_key", string(c.PrivateKeyPath)) + // Check that client well-known has a proper format + if c.WellKnownClientName != "" && !(strings.HasPrefix(c.WellKnownClientName, "http://") || strings.HasPrefix(c.WellKnownClientName, "https://")) { + logrus.Warn("The configuration for well_known_client_name does not have a proper format, consider adding http:// or https://. Some clients may fail to connect.") + } + for _, v := range c.VirtualHosts { v.Verify(configErrs) }