diff --git a/src/routes/webhooks/traefik/main.json.ts b/src/routes/webhooks/traefik/main.json.ts index 1bd277974..02270d73e 100644 --- a/src/routes/webhooks/traefik/main.json.ts +++ b/src/routes/webhooks/traefik/main.json.ts @@ -7,7 +7,7 @@ import { checkContainer } from '$lib/haproxy'; import type { RequestHandler } from '@sveltejs/kit'; function configureMiddleware( - { id, container, port, domain, nakedDomain, isHttps, isWWW, isDualCerts, scriptName }, + { id, container, port, domain, nakedDomain, isHttps, isWWW, isDualCerts, scriptName, type }, traefik ) { if (isHttps) { @@ -125,8 +125,10 @@ function configureMiddleware( } } } - if (scriptName !== 'plausible.js') { + + if (type === 'plausibleanalytics' && scriptName !== 'plausible.js') { if (!traefik.http.routers[`${id}`].middlewares.includes(`${id}-redir`)) { + console.log(traefik.http.routers[`${id}`].middlewares); traefik.http.routers[`${id}`].middlewares.push(`${id}-redir`); } if (!traefik.http.routers[`${id}-secure`].middlewares.includes(`${id}-redir`)) { @@ -343,11 +345,11 @@ export const get: RequestHandler = async (event) => { replacement: '/js/plausible.js' } }; - if (traefik.http.routers[id].middlewares.length > 0) { - traefik.http.routers[id].middlewares.push(`${id}-redir`); - } else { - traefik.http.routers[id].middlewares = [`${id}-redir`]; - } + // if (traefik.http.routers[id].middlewares.length > 0) { + // traefik.http.routers[id].middlewares.push(`${id}-redir`); + // } else { + // traefik.http.routers[id].middlewares = [`${id}-redir`]; + // } } } for (const coolify of data.coolify) {