From 28f40066a2b782dc60a98cd86c9f9412907e55e5 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 7 Dec 2025 20:03:54 -0600 Subject: [PATCH] fix(settings): simplify letsEncryptEmail assignment and ensure router rule is always updated with new host --- apps/dokploy/server/api/routers/settings.ts | 4 +--- packages/server/src/utils/traefik/web-server.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/dokploy/server/api/routers/settings.ts b/apps/dokploy/server/api/routers/settings.ts index 5610e8d96..00584bf2d 100644 --- a/apps/dokploy/server/api/routers/settings.ts +++ b/apps/dokploy/server/api/routers/settings.ts @@ -225,9 +225,7 @@ export const settingsRouter = createTRPCRouter({ } const user = await updateUser(ctx.user.ownerId, { host: input.host, - ...(input.letsEncryptEmail && { - letsEncryptEmail: input.letsEncryptEmail, - }), + letsEncryptEmail: input.letsEncryptEmail, certificateType: input.certificateType, https: input.https, }); diff --git a/packages/server/src/utils/traefik/web-server.ts b/packages/server/src/utils/traefik/web-server.ts index 02472a583..0209d9a21 100644 --- a/packages/server/src/utils/traefik/web-server.ts +++ b/packages/server/src/utils/traefik/web-server.ts @@ -23,11 +23,18 @@ export const updateServerTraefik = ( config.http.routers = config.http.routers || {}; config.http.services = config.http.services || {}; + // Get or create router config, but always update the rule with newHost const currentRouterConfig = config.http.routers[`${appName}-router-app`] || { - rule: `Host(\`${newHost}\`)`, service: `${appName}-service-app`, entryPoints: ["web"], + rule: `Host(\`${newHost}\`)`, }; + + // Always update the rule with the new host + if (newHost) { + currentRouterConfig.rule = `Host(\`${newHost}\`)`; + } + config.http.routers[`${appName}-router-app`] = currentRouterConfig; config.http.services = {