From e2f5cc37a50daf28ffe5f7622d4e9803bb08c0e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 3 Feb 2019 00:57:37 +0100 Subject: [PATCH] Add nossl page --- nixops/modules/websites/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix index 8c4380c..8563995 100644 --- a/nixops/modules/websites/default.nix +++ b/nixops/modules/websites/default.nix @@ -16,6 +16,23 @@ let documentRoot = vhostConf.root; extraConfig = builtins.concatStringsSep "\n" vhostConf.extraConfig; }; + nosslVhost = { + listen = [ { ip = cfg.ip; port = 80; } ]; + hostName = "nossl.immae.eu"; + enableSSL = false; + logFormat = "combinedVhost"; + documentRoot = ../../www; + extraConfig = '' + + DirectoryIndex nossl.html + AllowOverride None + Require all granted + + RewriteEngine on + RewriteRule ^/(.+) / [L] + + ''; + }; redirectVhost = { # Should go last, catchall http -> https redirect listen = [ { ip = cfg.ip; port = 80; } ]; hostName = "redirectSSL"; @@ -51,6 +68,7 @@ let extraModules = pkgs.lib.lists.unique (pkgs.lib.lists.flatten cfg.modules); extraConfig = builtins.concatStringsSep "\n" cfg.extraConfig; virtualHosts = [ fallbackVhost ] + ++ lib.optionals (name == "tools") [ nosslVhost ] ++ (pkgs.lib.attrsets.mapAttrsToList (n: v: toVhost v) cfg.vhostConfs) ++ [ redirectVhost ]; }; -- 2.41.0