forked from DGNum/infrastructure
feat(redirections): Add more precise redirection for retired websites, to make analytics relevant
This commit is contained in:
parent
a52b61cb28
commit
054f98fc34
2 changed files with 20 additions and 21 deletions
|
@ -9,7 +9,11 @@ let
|
|||
builtins.map
|
||||
(name: {
|
||||
inherit name;
|
||||
value.to = retired_host;
|
||||
value = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/".return = "301 https://${retired_host}/${name}";
|
||||
};
|
||||
})
|
||||
hosts
|
||||
);
|
||||
|
@ -17,6 +21,15 @@ let
|
|||
mkSub = domain: builtins.map (s: "${s}.${domain}");
|
||||
mkSubs = attrs: builtins.concatLists (builtins.attrValues (builtins.mapAttrs mkSub attrs));
|
||||
|
||||
mkRedirection =
|
||||
_:
|
||||
{ to }:
|
||||
{
|
||||
globalRedirect = to;
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
};
|
||||
|
||||
redirections = {
|
||||
"calendrier.eleves.ens.fr".to = "calendrier.dgnum.eu";
|
||||
"docs.beta.rz.ens.wtf".to = "pads.dgnum.eu";
|
||||
|
@ -26,7 +39,7 @@ let
|
|||
"rdv.dgnum.eu".to = "meet.dgnum.eu";
|
||||
"www.bda.ens.fr".to = "bda.ens.fr";
|
||||
"bda.wp.dgnum.eu".to = "bda.ens.fr";
|
||||
} // (mkRetired retired);
|
||||
};
|
||||
|
||||
retired = mkSubs {
|
||||
"ens.fr" = [
|
||||
|
@ -53,23 +66,7 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts =
|
||||
{
|
||||
${retired_host}.default = true;
|
||||
}
|
||||
// (builtins.mapAttrs
|
||||
(
|
||||
_:
|
||||
{
|
||||
to,
|
||||
ssl ? true,
|
||||
}:
|
||||
{
|
||||
globalRedirect = to;
|
||||
enableACME = ssl;
|
||||
forceSSL = ssl;
|
||||
}
|
||||
)
|
||||
redirections
|
||||
);
|
||||
services.nginx.virtualHosts = {
|
||||
${retired_host}.default = true;
|
||||
} // (builtins.mapAttrs mkRedirection redirections) // (mkRetired retired);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ in
|
|||
services.nginx.virtualHosts = recursiveUpdate (builtins.mapAttrs mkVhost websites) {
|
||||
"eleves.dgnum.eu".locations."/".tryFiles = "$uri $uri/index.html /fr/$uri /en/$uri /fr/index.html";
|
||||
|
||||
"retired.dgnum.eu".locations."/".tryFiles = "/index.html =404";
|
||||
|
||||
"simi.normalesup.eu" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
|
Loading…
Reference in a new issue