diff options
Diffstat (limited to 'modules/services/web/default.nix')
-rw-r--r-- | modules/services/web/default.nix | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/modules/services/web/default.nix b/modules/services/web/default.nix index b6a45af..0a7b392 100644 --- a/modules/services/web/default.nix +++ b/modules/services/web/default.nix @@ -1,10 +1,35 @@ -{ ... }: +{ config, ... }: +let + fqdn = "synapse.${config.networking.domain}"; + baseUrl = "https://${fqdn}"; +in { - services.caddy.virtualHosts = { - "tdback.net".extraConfig = '' - root * /var/www/tdback.net/ - encode zstd gzip - file_server - ''; + networking.domain = "tdback.net"; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; + + services.caddy = { + enable = true; + virtualHosts = { + ${config.networking.domain}.extraConfig = '' + handle /.well-known/matrix/server { + header Content-Type application/json + header Access-Control-Allow-Origin * + respond `{"m.server": "${fqdn}:443"}` + } + + handle /.well-known/matrix/client { + header Content-Type application/json + header Access-Control-Allow-Origin * + respond `{"m.homeserver": {"base_url": "${baseUrl}"}}` + } + + root * /var/www/tdback.net/ + encode zstd gzip + file_server + ''; + }; }; } |