diff --git a/machines/kat-watcher/default.nix b/machines/kat-watcher/default.nix index f5b1cb0..2be67e2 100644 --- a/machines/kat-watcher/default.nix +++ b/machines/kat-watcher/default.nix @@ -71,23 +71,61 @@ in { enable = true; - virtualHosts = builtins.mapAttrs (_: _: { - enableACME = true; - forceSSL = true; - acmeFallbackHost = kat-r86s; - acmeFallbackRecommendedProxySettings = true; - locations."/" = { - recommendedProxySettings = true; - proxyPass = "https://${kat-r86s}/"; - extraConfig = '' - proxy_set_header Connection '''; - proxy_http_version 1.1; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; + virtualHosts = + let + watcher-webroot = pkgs.runCommand "watcher" { } '' + mkdir -p $out/.kat-watcher/ + ln -nsf ${./error} $out/.kat-watcher/error ''; - }; - }) vhosts; + in + { + "watcher.katvayor.net" = { + enableACME = true; + forceSSL = true; + locations = { + "/.kat-watcher" = { + extraConfig = '' + internal; + error_page 404 =418 /.kat-watcher/error/418.html; + ''; + root = watcher-webroot; + }; + "/" = { + extraConfig = '' + return 418; + error_page 418 =418 /.kat-watcher/error/418.html; + ''; + }; + }; + }; + } + // builtins.mapAttrs (_: _: { + enableACME = true; + forceSSL = true; + acmeFallbackHost = kat-r86s; + acmeFallbackRecommendedProxySettings = true; + locations = { + "/.kat-watcher" = { + extraConfig = '' + internal; + error_page 404 =418 /.kat-watcher/error/418.html; + ''; + root = watcher-webroot; + }; + "/" = { + recommendedProxySettings = true; + proxyPass = "https://${kat-r86s}/"; + extraConfig = '' + proxy_set_header Connection '''; + proxy_http_version 1.1; + chunked_transfer_encoding off; + proxy_buffering off; + proxy_cache off; + error_page 502 =599 "/.kat-watcher/error/599.html"; + ''; + }; + }; + }) vhosts; streamConfig = builtins.concatStringsSep "\n" ( lib.mapAttrsToList ( diff --git a/machines/kat-watcher/error/418.html b/machines/kat-watcher/error/418.html new file mode 100644 index 0000000..f6701c5 --- /dev/null +++ b/machines/kat-watcher/error/418.html @@ -0,0 +1,20 @@ + + + + + + 418 I’m a teapot + + +
+

418 I’m a teapot

+ +
+
+
+ Crédit à http.cat pour l'image. +
+ Error in watcher. +
+ + diff --git a/machines/kat-watcher/error/599.html b/machines/kat-watcher/error/599.html new file mode 100644 index 0000000..bdb8af2 --- /dev/null +++ b/machines/kat-watcher/error/599.html @@ -0,0 +1,21 @@ + + + + + + 599 Network Connect Timeout Error + + +
+

599 Network Connect Timeout Error

+ +

Le contact avec l'hyperviseur n'a pas pu se faire.

+
+
+
+ Crédit à http.cat pour l'image. +
+ Error in watcher. +
+ +