From d5dd35c8f89f74507a730f3077c630ebf5a66f5b Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 14 Jul 2026 11:39:30 -0600 Subject: [PATCH] fix(settings): allow clearing the server domain The Server Domain form rejected an empty value ('Invalid domain name'), making domain assignment a one-way operation. The backend already removes the Traefik router and clears the host when it receives an empty host, so only the client-side validation blocked removal. Allow an empty domain to clear it, and skip the https/letsencrypt requirements when the domain is being removed. Fixes #4821 --- apps/dokploy/components/dashboard/settings/web-domain.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/components/dashboard/settings/web-domain.tsx b/apps/dokploy/components/dashboard/settings/web-domain.tsx index 4f543a1be..187bbb452 100644 --- a/apps/dokploy/components/dashboard/settings/web-domain.tsx +++ b/apps/dokploy/components/dashboard/settings/web-domain.tsx @@ -43,7 +43,8 @@ const addServerDomain = z .string() .trim() .toLowerCase() - .refine((val) => VALID_HOSTNAME_REGEX.test(val), { + // empty clears the server domain and reverts to IP-only access + .refine((val) => val === "" || VALID_HOSTNAME_REGEX.test(val), { message: INVALID_HOSTNAME_MESSAGE, }), letsEncryptEmail: z.string(), @@ -51,7 +52,7 @@ const addServerDomain = z certificateType: z.enum(["letsencrypt", "none", "custom"]), }) .superRefine((data, ctx) => { - if (data.https && !data.certificateType) { + if (data.domain && data.https && !data.certificateType) { ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["certificateType"], @@ -59,6 +60,7 @@ const addServerDomain = z }); } if ( + data.domain && data.https && data.certificateType === "letsencrypt" && !data.letsEncryptEmail