diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-16 09:34:09 +0000 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-16 09:34:09 +0000 |
commit | d558da1c875704b101dbb26d56e08cd0f6369d35 (patch) | |
tree | 02abe350893d0697aa9f6818940ffc1689c8004e /federationapi/routing | |
parent | deddf686b9e9be236ca4e3cc265c7cfba38ed4ee (diff) |
Virtual host server name workaround
Diffstat (limited to 'federationapi/routing')
-rw-r--r-- | federationapi/routing/keys.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/federationapi/routing/keys.go b/federationapi/routing/keys.go index 693f5b9f..8194c990 100644 --- a/federationapi/routing/keys.go +++ b/federationapi/routing/keys.go @@ -16,6 +16,7 @@ package routing import ( "encoding/json" + "net" "net/http" "time" @@ -190,7 +191,16 @@ func localKeys(cfg *config.FederationAPI, serverName gomatrixserverlib.ServerNam identity, err := cfg.Matrix.SigningIdentityFor(serverName) if err != nil { - return nil, err + // TODO: This is a bit of a hack because the Host header can contain a port + // number if it's specified in the well-known file. Try getting a signing + // identity without it to see if that helps. + var h string + if h, _, err = net.SplitHostPort(string(serverName)); err == nil { + identity, err = cfg.Matrix.SigningIdentityFor(gomatrixserverlib.ServerName(h)) + } + if err != nil { + return nil, err + } } keys.Raw, err = gomatrixserverlib.SignJSON( |