diff --git a/roles/server/syncthing.nix b/roles/server/syncthing.nix index c8c5049..3378689 100755 --- a/roles/server/syncthing.nix +++ b/roles/server/syncthing.nix @@ -16,4 +16,23 @@ }; }; }; + + # Set up traefik as the reverse proxy for syncthing + services.traefik = { + dynamicConfigOptions = { + http = { + routers = { + syncthing-subpath = { + middlewares = [ "syncthing-strip-prefix" ]; + rule = "PathPrefix(`/syncthing/`)"; + service = "syncthing"; + }; + }; + services.syncthing.loadBalancer.servers = [ + { url = "http://localhost:8384"; } + ]; + middlewares.syncthing-strip-prefix.stripprefix.prefixes = "/syncthing"; + }; + }; + }; }