]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/chloe/production.nix
Redirect websites landing pages
[perso/Immae/Config/Nix.git] / modules / private / websites / chloe / production.nix
index 0562de8d2f825f3fc6ea670aa4c4e444111d143f..578bf918cab22fecc52798a546560d1d731a3965 100644 (file)
@@ -1,8 +1,8 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
   chloe = pkgs.callPackage ./builder.nix {
     inherit (pkgs.webapps) chloe;
-    config = myconfig.env.websites.chloe.production;
+    config = config.myEnv.websites.chloe.production;
     apacheUser = config.services.httpd.Prod.user;
     apacheGroup = config.services.httpd.Prod.group;
   };
@@ -33,7 +33,14 @@ in {
       certMainHost = "osteopathe-cc.fr";
       hosts        = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
       root         = chloe.apache.root;
-      extraConfig  = [ chloe.apache.vhostConf ];
+      extraConfig  = [
+        ''
+          RewriteEngine On
+          RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC]
+          RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L]
+          ''
+        chloe.apache.vhostConf
+      ];
     };
     services.websites.env.production.watchPaths = [
       "/var/secrets/webapps/${chloe.app.environment}-chloe"