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: remote webhooks
Andras Bacsaibf33d6c34eee
diff --git a/apps/api/src/routes/webhooks/traefik/handlers.ts b/apps/api/src/routes/webhooks/traefik/handlers.tsindex 05b58c6aba..9770753395 100644--- a/apps/api/src/routes/webhooks/traefik/handlers.ts+++ b/apps/api/src/routes/webhooks/traefik/handlers.ts@@ -1,6 +1,5 @@import { FastifyRequest } from "fastify";import { errorHandler, getDomain, isDev, prisma, executeDockerCmd, fixType } from "../../../lib/common";-import { TraefikOtherConfiguration } from "./types";import { OnlyId } from "../../../types";function generateServices(id, containerId, port) {@@ -292,15 +291,40 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remoteconsole.log(error)}}+ if (!remote) {+ const { fqdn, dualCerts } = await prisma.setting.findFirst();+ if (!fqdn) {+ return+ }++ const domain = getDomain(fqdn);+ const nakedDomain = domain.replace(/^www\./, '');+ const isHttps = fqdn.startsWith('https://');+ const isWWW = fqdn.includes('www.');+ const id = isDev ? 'host.docker.internal' : 'coolify'+ const container = isDev ? 'host.docker.internal' : 'coolify'+ const port = 3000+ const pathPrefix = '/'+ const isCustomSSL = false++ traefik.http.routers = { ...traefik.http.routers, ...generateRouters(`${id}-${port || 'default'}`, domain, nakedDomain, pathPrefix, isHttps, isWWW, dualCerts, isCustomSSL) }+ traefik.http.services = { ...traefik.http.services, ...generateServices(id, container, port) }+ }}} catch (error) {console.log(error)} finally {+ if (Object.keys(traefik.http.routers).length === 0) {+ traefik.http.routers = null;+ }+ if (Object.keys(traefik.http.services).length === 0) {+ traefik.http.services = null;+ }return traefik;}}-export async function traefikOtherConfiguration(request: FastifyRequest<TraefikOtherConfiguration>) {+export async function otherProxyConfiguration(request: FastifyRequest<TraefikOtherConfiguration>) {try {const { id } = request.queryif (id) {diff --git a/apps/api/src/routes/webhooks/traefik/index.ts b/apps/api/src/routes/webhooks/traefik/index.tsindex ce4dff0f8f..36ce68df07 100644--- a/apps/api/src/routes/webhooks/traefik/index.ts+++ b/apps/api/src/routes/webhooks/traefik/index.ts@@ -1,13 +1,12 @@import { FastifyPluginAsync } from 'fastify';import { OnlyId } from '../../../types';-import { proxyConfiguration, traefikConfiguration, traefikOtherConfiguration } from './handlers';-import { TraefikOtherConfiguration } from './types';+import { proxyConfiguration, otherProxyConfiguration } from './handlers';+import { OtherProxyConfiguration } from './types';const root: FastifyPluginAsync = async (fastify): Promise<void> => {fastify.get<OnlyId>('/main.json', async (request, reply) => proxyConfiguration(request, false));- fastify.get<OnlyId>('/test', async (request, reply) => proxyConfiguration(request, false));- fastify.get<OnlyId>('/remote/:id', async (request) => traefikConfiguration(request, true));- fastify.get<TraefikOtherConfiguration>('/other.json', async (request, reply) => traefikOtherConfiguration(request));+ fastify.get<OnlyId>('/remote/:id', async (request) => proxyConfiguration(request, true));+ fastify.get<OtherProxyConfiguration>('/other.json', async (request, reply) => otherProxyConfiguration(request));};export default root;diff --git a/apps/api/src/routes/webhooks/traefik/types.ts b/apps/api/src/routes/webhooks/traefik/types.tsindex 237d746fe6..141066111f 100644--- a/apps/api/src/routes/webhooks/traefik/types.ts+++ b/apps/api/src/routes/webhooks/traefik/types.ts@@ -1,4 +1,4 @@-export interface TraefikOtherConfiguration {+export interface OtherProxyConfiguration {Querystring: {id: string,privatePort: number,