move the hive's vhosts and matrix discovery out of the gateway
The dashboard vhost, the hive domain vhost and the dashboard's local name move to hive-c0re/vhosts.nix; the matrix .well-known discovery and the legacy /matrix/ redirect move to glue-matrix-hive-discovery.nix, which adds them to the hive domain vhost. Both declare through gateway.vhosts. hive-gateway/vhosts.nix keeps the catch-all only, and the gateway no longer reads deploy.matrix or c0re.servedFrontend, nor deploy.hive-controller.enable for its vhosts. Part of #3742.
This commit is contained in:
parent
2489830772
commit
b4c5954491
17 changed files with 391 additions and 378 deletions
|
|
@ -484,12 +484,13 @@ let
|
|||
&& allLocal.systemd.services.hive-c0re.environment.HYPERHIVE_DASHBOARD_DOMAIN == "h1.hives.t.local";
|
||||
}
|
||||
{
|
||||
# The gateway's own three vhosts are declared under `gateway.vhosts` like
|
||||
# a service's, so the gateway's listen set and issuer choice reach them
|
||||
# The gateway's catch-all and the hive's two vhosts (../host-modules/
|
||||
# hive-c0re/vhosts.nix) are declared under `gateway.vhosts` like a
|
||||
# service's, so the gateway's listen set and issuer choice reach them
|
||||
# by the same path. The catch-all keeps its bare `return 444;` (no
|
||||
# headers: it sends no response) and the dashboard keeps its exact
|
||||
# location set.
|
||||
name = "the gateway's own vhosts render with its listen set, issuer choice, headers and locations";
|
||||
name = "the catch-all and the hive's vhosts render with the gateway's listen set, issuer choice, headers and locations";
|
||||
ok =
|
||||
let
|
||||
gw = allLocal.services.hyperhive.gateway;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,31 @@ let
|
|||
matrixElsewhere.systemd.services.hive-c0re.environment.HIVE_MATRIX_API_URL
|
||||
== "https://chat.t.local";
|
||||
}
|
||||
{
|
||||
# The discovery locations reach the hive domain's vhost from a glue
|
||||
# module, merged into the vhost hive-c0re declares. The matrix-elsewhere
|
||||
# arm reads the same vhost, which still exists there with its redirect,
|
||||
# so its absence of discovery cannot pass on a misspelled name.
|
||||
name = "matrix discovery sits on the hive domain's vhost only where the homeserver runs";
|
||||
ok =
|
||||
let
|
||||
here = matrixNoBaoIdentity.services.nginx.virtualHosts."h1.t.local".locations;
|
||||
elsewhere = matrixElsewhere.services.nginx.virtualHosts."h1.t.local".locations;
|
||||
in
|
||||
lib.hasInfix ''{"m.homeserver":{"base_url":"https://chat.t.local"}}'' (
|
||||
here."= /.well-known/matrix/client".extraConfig or ""
|
||||
)
|
||||
&& lib.hasInfix ''{"m.server":"chat.t.local:443"}'' (
|
||||
here."= /.well-known/matrix/server".extraConfig or ""
|
||||
)
|
||||
&& lib.hasInfix "rewrite ^/matrix/(.*)$ https://chat.t.local/$1 permanent;" (
|
||||
here."/matrix/".extraConfig or ""
|
||||
)
|
||||
&& lib.hasInfix "return 301 https://h1.hives.t.local$request_uri;" here."/".extraConfig
|
||||
&& elsewhere ? "/"
|
||||
&& !(elsewhere ? "= /.well-known/matrix/client")
|
||||
&& !(elsewhere ? "/matrix/");
|
||||
}
|
||||
];
|
||||
in
|
||||
runGroup "matrix-core" cases
|
||||
|
|
|
|||
Loading…
Reference in a new issue