Commit f3580a88bea0
Changed files (1)
systems
rhea
systems/rhea/extra.nix
@@ -77,7 +77,10 @@
rule = "Host(`syncthing.sbr.pm`) && PathPrefix(`/${name}`) || Host(`s.sbr.pm`) && PathPrefix(`/${name}`)";
service = "syncthing-${name}";
entryPoints = [ "websecure" ];
- middlewares = [ "syncthing-${name}-strip" ];
+ middlewares = [
+ "syncthing-${name}-addslash"
+ "syncthing-${name}-strip"
+ ];
tls = {
certResolver = "letsencrypt";
};
@@ -105,6 +108,18 @@
};
}
) syncthingMachines;
+
+ # Generate middleware for adding trailing slash
+ syncthingAddSlashMiddlewares = lib.mapAttrs' (
+ name: _machine:
+ lib.nameValuePair "syncthing-${name}-addslash" {
+ redirectRegex = {
+ regex = "^(https?://[^/]+/${name})$";
+ replacement = "$${1}/";
+ permanent = true;
+ };
+ }
+ ) syncthingMachines;
in
{
http = {
@@ -247,7 +262,7 @@
};
};
};
- middlewares = syncthingMiddlewares;
+ middlewares = syncthingMiddlewares // syncthingAddSlashMiddlewares;
};
tcp = {
routers = {