From ab5e088016d6576cfb01a9b4d6a842995728a5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Mon, 18 Sep 2023 04:17:16 +0200 Subject: [PATCH] conduit: Add Element X support --- configuration/services/conduit.nix | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/configuration/services/conduit.nix b/configuration/services/conduit.nix index 871b5e2..2d341b7 100644 --- a/configuration/services/conduit.nix +++ b/configuration/services/conduit.nix @@ -207,12 +207,28 @@ in { merge_slashes off; ''; - locations."/_matrix" = { - proxyPass = "http://${cfg.settings.global.address}:${toString cfg.settings.global.port}"; - # Recommended by conduit - extraConfig = '' - proxy_buffering off; - ''; + locations = { + "/_matrix" = { + proxyPass = "http://${cfg.settings.global.address}:${toString cfg.settings.global.port}"; + # Recommended by conduit + extraConfig = '' + proxy_buffering off; + ''; + }; + + # Add Element X support + # TODO(tlater): Remove when no longer required: https://github.com/vector-im/element-x-android/issues/1085 + "=/.well-known/matrix/client" = { + alias = pkgs.writeText "well-known-matrix-client" (builtins.toJSON { + "m.homeserver".base_url = "https://${domain}"; + "org.matrix.msc3575.proxy".url = "https://${domain}"; + }); + + extraConfig = '' + default_type application/json; + add_header Access-Control-Allow-Origin "*"; + ''; + }; }; }; }