Merge pull request #5214 from Dokploy/fix/issue-4658-domain-validation-multi-ip

fix: domain validation false negative on servers with multiple IPs
This commit is contained in:
Mauricio Siu
2026-08-28 16:50:48 -06:00
committed by GitHub
3 changed files with 68 additions and 11 deletions
@@ -191,8 +191,7 @@ export const ShowDomains = ({ id, type }: Props) => {
try {
const result = await validateDomain({
domain: host,
serverIp:
application?.server?.ipAddress?.toString() || ip?.toString() || "",
serverId: application?.serverId ?? undefined,
});
setValidationStates((prev) => ({
+15 -3
View File
@@ -7,6 +7,7 @@ import {
findPreviewDeploymentById,
findServerById,
generateTraefikMeDomain,
getServerIpCandidates,
getWebServerSettings,
manageDomain,
removeDomain,
@@ -248,10 +249,21 @@ export const domainRouter = createTRPCRouter({
.input(
z.object({
domain: z.string(),
serverIp: z.string().optional(),
serverId: z.string().optional(),
}),
)
.mutation(async ({ input }) => {
return validateDomain(input.domain, input.serverIp);
.mutation(async ({ input, ctx }) => {
if (input.serverId) {
const server = await findServerById(input.serverId);
if (server.organizationId !== ctx.session.activeOrganizationId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not authorized to access this server",
});
}
}
const expectedIps = await getServerIpCandidates(input.serverId);
return validateDomain(input.domain, expectedIps);
}),
});