{ config , lib , pkgs , ... }: { networking = lib.mkIf pkgs.stdenv.isLinux { hosts = { "127.0.0.80" = [ "alanpearce.test" ]; }; }; services.caddy = { enable = true; virtualHosts = { "localhost" = { extraConfig = '' tls { issuer internal { ca local } } acme_server { allow { domains *.test } } ''; }; "alanpearce.test" = { serverAliases = [ "alanpearce.localhost" ]; extraConfig = '' tls { issuer internal { ca local } } reverse_proxy http://alanpearce.test:3000 { header_up Host alanpearce.test transport http { dial_timeout 1s compression off } } redir / https://alanpearce.test:8443 302 ''; }; "searchix.localhost" = { extraConfig = '' reverse_proxy http://localhost:7331 { transport http { dial_timeout 1s compression off } } ''; }; }; }; }