diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-02-03 00:57:37 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-02-03 00:57:37 +0100 |
commit | e2f5cc37a50daf28ffe5f7622d4e9803bb08c0e7 (patch) | |
tree | 09f5924db6547231b0944e5ae4516da85e4c8ac5 /nixops/modules | |
parent | ce493c5de8a950b683f6de64cda0b6a8459b87db (diff) | |
download | Nix-e2f5cc37a50daf28ffe5f7622d4e9803bb08c0e7.tar.gz Nix-e2f5cc37a50daf28ffe5f7622d4e9803bb08c0e7.tar.zst Nix-e2f5cc37a50daf28ffe5f7622d4e9803bb08c0e7.zip |
Add nossl page
Diffstat (limited to 'nixops/modules')
-rw-r--r-- | nixops/modules/websites/default.nix | 18 |
1 files changed, 18 insertions, 0 deletions
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 | |||
16 | documentRoot = vhostConf.root; | 16 | documentRoot = vhostConf.root; |
17 | extraConfig = builtins.concatStringsSep "\n" vhostConf.extraConfig; | 17 | extraConfig = builtins.concatStringsSep "\n" vhostConf.extraConfig; |
18 | }; | 18 | }; |
19 | nosslVhost = { | ||
20 | listen = [ { ip = cfg.ip; port = 80; } ]; | ||
21 | hostName = "nossl.immae.eu"; | ||
22 | enableSSL = false; | ||
23 | logFormat = "combinedVhost"; | ||
24 | documentRoot = ../../www; | ||
25 | extraConfig = '' | ||
26 | <Directory ${../../www}> | ||
27 | DirectoryIndex nossl.html | ||
28 | AllowOverride None | ||
29 | Require all granted | ||
30 | |||
31 | RewriteEngine on | ||
32 | RewriteRule ^/(.+) / [L] | ||
33 | </Directory> | ||
34 | ''; | ||
35 | }; | ||
19 | redirectVhost = { # Should go last, catchall http -> https redirect | 36 | redirectVhost = { # Should go last, catchall http -> https redirect |
20 | listen = [ { ip = cfg.ip; port = 80; } ]; | 37 | listen = [ { ip = cfg.ip; port = 80; } ]; |
21 | hostName = "redirectSSL"; | 38 | hostName = "redirectSSL"; |
@@ -51,6 +68,7 @@ let | |||
51 | extraModules = pkgs.lib.lists.unique (pkgs.lib.lists.flatten cfg.modules); | 68 | extraModules = pkgs.lib.lists.unique (pkgs.lib.lists.flatten cfg.modules); |
52 | extraConfig = builtins.concatStringsSep "\n" cfg.extraConfig; | 69 | extraConfig = builtins.concatStringsSep "\n" cfg.extraConfig; |
53 | virtualHosts = [ fallbackVhost ] | 70 | virtualHosts = [ fallbackVhost ] |
71 | ++ lib.optionals (name == "tools") [ nosslVhost ] | ||
54 | ++ (pkgs.lib.attrsets.mapAttrsToList (n: v: toVhost v) cfg.vhostConfs) | 72 | ++ (pkgs.lib.attrsets.mapAttrsToList (n: v: toVhost v) cfg.vhostConfs) |
55 | ++ [ redirectVhost ]; | 73 | ++ [ redirectVhost ]; |
56 | }; | 74 | }; |