From 27ba3f7a7ff4649a9326565974e0c8181e485b7b Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Tue, 28 Nov 2023 08:36:56 +0100 Subject: [PATCH] bicep/matrix: serve server well-known --- hosts/bicep/services/matrix/synapse.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hosts/bicep/services/matrix/synapse.nix b/hosts/bicep/services/matrix/synapse.nix index 1341dec..2b0d160 100644 --- a/hosts/bicep/services/matrix/synapse.nix +++ b/hosts/bicep/services/matrix/synapse.nix @@ -216,7 +216,19 @@ in { services.redis.servers."".enable = true; - services.nginx.virtualHosts."matrix.pvv.ntnu.no" = lib.mkMerge [({ + services.nginx.virtualHosts."matrix.pvv.ntnu.no" = lib.mkMerge [ + ({ + locations."/.well-known/matrix/server" = { + return = '' + 200 '{"m.server": "matrix.pvv.ntnu.no:443"}' + ''; + extraConfig = '' + default_type application/json; + add_header Access-Control-Allow-Origin *; + ''; + }; + }) + ({ locations = let connectionInfo = w: matrix-lib.workerConnectionResource "metrics" w; socketAddress = w: let c = connectionInfo w; in "${c.host}:${toString (c.port)}";