From fbf95c536311efe4eb88921cf9f67e419b4f947f Mon Sep 17 00:00:00 2001 From: Owen Date: Fri, 1 May 2026 16:51:17 -0700 Subject: [PATCH] Start creating ns one level down --- .../routers/certificates/createCertificate.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/private/routers/certificates/createCertificate.ts b/server/private/routers/certificates/createCertificate.ts index 60ca2072a..048b92352 100644 --- a/server/private/routers/certificates/createCertificate.ts +++ b/server/private/routers/certificates/createCertificate.ts @@ -79,7 +79,7 @@ export async function createCertificate( let domainToWrite = domain; if ( - domainRecord.type == "wildcard" && + domainRecord.type == "wildcard" && // this is to fix the wildcard certs for traefik in self hosted NOT ON THE CLOUD domainRecord.preferWildcardCert && !domain.startsWith("*.") ) { @@ -89,6 +89,16 @@ export async function createCertificate( domainToWrite = parts.slice(1).join("."); domainToWrite = `*.${domainToWrite}`; } + } else if (domainRecord.type == "ns") { + // first if we have a * in the domain for this case we dont want to include it because it will mess with the cert generator so remove it + if (domain.startsWith("*.")) { + domain = domain.slice(2); + } + + const parts = domain.split("."); + if (parts.length > 2) { + domainToWrite = parts.slice(1).join("."); + } } // No cert found, create a new one in pending state