From aa2e0e81c6c611bf4e567e0dd3d30892bb992354 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sat, 7 Feb 2026 00:34:43 -0600 Subject: [PATCH] feat(settings): run Traefik setup in background to prevent proxy timeouts - Modified the Traefik setup call to execute in the background, allowing immediate response to the client. - Added error handling to log any issues during the background execution of the Traefik setup. --- apps/dokploy/server/api/routers/settings.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/dokploy/server/api/routers/settings.ts b/apps/dokploy/server/api/routers/settings.ts index 04d5c1022..9ab3ee136 100644 --- a/apps/dokploy/server/api/routers/settings.ts +++ b/apps/dokploy/server/api/routers/settings.ts @@ -158,10 +158,14 @@ export const settingsRouter = createTRPCRouter({ newPorts = ports.filter((port) => port.targetPort !== 8080); } - await writeTraefikSetup({ + // Run in background so the request returns immediately; client polls /api/health. + // Avoids proxy timeouts (520) while Traefik is recreated. + void writeTraefikSetup({ env: preparedEnv, additionalPorts: newPorts, serverId: input.serverId, + }).catch((err) => { + console.error("toggleDashboard background writeTraefikSetup:", err); }); return true; }),