From 88a712eac95dfc0326a95df31b5077c15bc2efc0 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 31 Aug 2023 23:27:35 +0200 Subject: [PATCH] Syncthing: use traefik as reverse proxy --- roles/server/syncthing.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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"; + }; + }; + }; }