fix(nix): emit explicit port in .well-known/matrix/server delegation
The matrix server-server spec resolves a portless m.server delegated host to the federation default port 8448 (not 443 — the URL convention that https implies 443 does not apply to the m.server field). The gateway reused publicPortSuffix, which intentionally drops :443 for the client base_url, so .well-known/matrix/server advertised the bare gateway host. Peers then federated to <gatewayHost>:8448, which nothing listens on, while the federation endpoint actually lives on the gateway 443 vhost (/_matrix/ proxied to tuwunel). Always emit the explicit port in the federation delegation so peers reach the live 443 endpoint.
This commit is contained in:
parent
31d9cb561a
commit
48b7c24265
1 changed files with 13 additions and 1 deletions
|
|
@ -718,9 +718,21 @@ in
|
||||||
"${publicScheme}://${matrixCfg.gatewayHost}${publicPortSuffix}"
|
"${publicScheme}://${matrixCfg.gatewayHost}${publicPortSuffix}"
|
||||||
else
|
else
|
||||||
"${publicScheme}://${hyperhiveDomain}:${toString matrixCfg.httpPort}";
|
"${publicScheme}://${hyperhiveDomain}:${toString matrixCfg.httpPort}";
|
||||||
|
# `m.server` is NOT a URL: per the matrix
|
||||||
|
# server-server spec (Resolving Server Names) a
|
||||||
|
# delegated host with NO port resolves to the
|
||||||
|
# federation default 8448 (after the SRV check) —
|
||||||
|
# the https-implies-443 rule does NOT apply here.
|
||||||
|
# So the port must be explicit even when it's the
|
||||||
|
# HTTPS default; `publicPortSuffix` (which drops
|
||||||
|
# :443) is right for the client base_url above but
|
||||||
|
# wrong for federation delegation. Without this,
|
||||||
|
# peers federate to <gatewayHost>:8448 (closed) while
|
||||||
|
# the endpoint actually lives on the gateway's 443
|
||||||
|
# vhost. See docs/gateway.md discovery flow.
|
||||||
serverHostPort =
|
serverHostPort =
|
||||||
if matrixCfg.gatewayHost != null then
|
if matrixCfg.gatewayHost != null then
|
||||||
"${matrixCfg.gatewayHost}${publicPortSuffix}"
|
"${matrixCfg.gatewayHost}:${toString publicPort}"
|
||||||
else
|
else
|
||||||
"${hyperhiveDomain}:${toString matrixCfg.httpPort}";
|
"${hyperhiveDomain}:${toString matrixCfg.httpPort}";
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue