From: Ismaƫl Bouya Date: Sat, 2 Feb 2019 23:57:37 +0000 (+0100) Subject: Add nossl page X-Git-Tag: nur_publish~261 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=commitdiff_plain;h=e2f5cc37a50daf28ffe5f7622d4e9803bb08c0e7;hp=ce493c5de8a950b683f6de64cda0b6a8459b87db Add nossl page --- 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 ]; };