diff --git a/modules/services/mailserver.nix b/modules/services/mailserver.nix index a010711..68524ae 100644 --- a/modules/services/mailserver.nix +++ b/modules/services/mailserver.nix @@ -477,6 +477,25 @@ in ''; }; }; + virtualHosts."${cfg.subdomain}.${cfg.domain}" = + let + landingPage = pkgs.writeTextDir "index.html" '' +
+Configuration of the mailserver is done automatically thanks to + ${cfg.domain}/.well-known/autoconfig/mail/config-v1.1.xml.
+ + ''; + in + { + forceSSL = true; # Redirect HTTP → HTTPS + root = "/var/www"; # Dummy root + locations."/" = { + alias = "${landingPage}/"; + extraConfig = '' + default_type application/html; + ''; + }; + }; }; }) (lib.mkIf (cfg.enable && cfg.adminUsername != null) {