An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix fqdn check
Andras Bacsaiaa27aeafa1f4
diff --git a/apps/api/src/routes/api/v1/services/handlers.ts b/apps/api/src/routes/api/v1/services/handlers.tsindex 52f52c7f27..dccfcc2f59 100644--- a/apps/api/src/routes/api/v1/services/handlers.ts+++ b/apps/api/src/routes/api/v1/services/handlers.ts@@ -436,23 +436,17 @@ export async function checkServiceDomain(request: FastifyRequest<CheckServiceDomexport async function checkService(request: FastifyRequest<CheckService>) {try {const { id } = request.params;- let { fqdn, exposePort, forceSave, dualCerts } = request.body;- const otherFqdns = await prisma.serviceSetting.findMany({where: { variableName: {startsWith: '$$coolify_fqdn'}}})- let domainsList = []+ let { fqdn, exposePort, forceSave, dualCerts, otherFqdn = false } = request.body;++ const domainsList = await prisma.serviceSetting.findMany({ where: { variableName: { startsWith: '$$coolify_fqdn' } } })+if (fqdn) fqdn = fqdn.toLowerCase();- if (otherFqdns && otherFqdns.length > 0) {- domainsList = otherFqdns.filter((f) => {- if(f.serviceId !== id) {- return f- }- });- }if (exposePort) exposePort = Number(exposePort);const { destinationDocker: { remoteIpAddress, remoteEngine, engine }, exposePort: configuredPort } = await prisma.service.findUnique({ where: { id }, include: { destinationDocker: true } })const { isDNSCheckEnabled } = await prisma.setting.findFirst({});- let found = await isDomainConfigured({ id, fqdn, remoteIpAddress });+ let found = await isDomainConfigured({ id, fqdn, remoteIpAddress, checkOwn: otherFqdn });if (found) {throw { status: 500, message: `Domain ${getDomain(fqdn).replace('www.', '')} is already in use!` }}diff --git a/apps/api/src/routes/api/v1/services/types.ts b/apps/api/src/routes/api/v1/services/types.tsindex 5839724c83..253c5bcab8 100644--- a/apps/api/src/routes/api/v1/services/types.ts+++ b/apps/api/src/routes/api/v1/services/types.ts@@ -40,7 +40,7 @@ export interface CheckService extends OnlyId {forceSave: boolean,dualCerts: boolean,exposePort: number,- otherFqdns: Array<string>+ otherFqdn: boolean}}export interface SaveService extends OnlyId {diff --git a/apps/ui/src/routes/_NewResource.svelte b/apps/ui/src/routes/_NewResource.svelteindex 1814648217..c02221d024 100644--- a/apps/ui/src/routes/_NewResource.svelte+++ b/apps/ui/src/routes/_NewResource.svelte@@ -16,6 +16,7 @@}</script>+<!-- svelte-ignore a11y-no-noninteractive-tabindex --><div class="dropdown dropdown-bottom"><slot><label for="new" tabindex="0" class="btn btn-sm text-sm bg-coollabs hover:bg-coollabs-100 w-64">diff --git a/apps/ui/src/routes/index.svelte b/apps/ui/src/routes/index.svelteindex e0ab74b063..52d5adebc5 100644--- a/apps/ui/src/routes/index.svelte+++ b/apps/ui/src/routes/index.svelte@@ -541,6 +541,7 @@</div><div class="form-control"><div class="input-group flex w-full">+ <!-- svelte-ignore a11y-click-events-have-key-events --><divclass="btn btn-square cursor-default no-animation hover:bg-error"on:click={() => doSearch('')}diff --git a/apps/ui/src/routes/services/[id]/index.svelte b/apps/ui/src/routes/services/[id]/index.svelteindex 2109f0d664..03d197aa2f 100644--- a/apps/ui/src/routes/services/[id]/index.svelte+++ b/apps/ui/src/routes/services/[id]/index.svelte@@ -78,13 +78,29 @@if (loading.save) return;loading.save = true;try {+ const formData = new FormData(e.target);await post(`/services/${id}/check`, {fqdn: service.fqdn,forceSave,dualCerts,exposePort: service.exposePort});- const formData = new FormData(e.target);+ for (const setting of service.serviceSetting) {+ if (setting.variableName.startsWith('$$coolify_fqdn') && setting.value) {+ for (let field of formData) {+ const [key, value] = field;+ if (setting.name === key) {+ if (setting.value !== value) {+ await post(`/services/${id}/check`, {+ fqdn: value,+ otherFqdn: true+ });+ }+ }+ }+ }+ }+if (formData) service = await saveForm(formData, service);setLocation(service);forceSave = false;