From 797931dfe97e669f5f73c4c132d1c78b85cdbb47 Mon Sep 17 00:00:00 2001 From: Lorenzo Migliorero Date: Mon, 29 Jul 2024 16:31:49 +0200 Subject: [PATCH 1/3] feat: remove path prefix if different than / --- __test__/traefik/traefik.test.ts | 11 +++++++++++ server/utils/traefik/domain.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/__test__/traefik/traefik.test.ts b/__test__/traefik/traefik.test.ts index ce35611f..80a10826 100644 --- a/__test__/traefik/traefik.test.ts +++ b/__test__/traefik/traefik.test.ts @@ -88,6 +88,17 @@ test("Web entrypoint on http domain", async () => { ); expect(router.middlewares).not.toContain("redirect-to-https"); + expect(router.rule).not.toContain("PathPrefix"); +}); + +test("Web entrypoint on http domain with custom path", async () => { + const router = await createRouterConfig( + baseApp, + { ...baseDomain, path: "/foo", https: false }, + "web", + ); + + expect(router.rule).toContain("PathPrefix(`/foo`)"); }); test("Web entrypoint on http domain with redirect", async () => { diff --git a/server/utils/traefik/domain.ts b/server/utils/traefik/domain.ts index 401c7a8e..3a34f045 100644 --- a/server/utils/traefik/domain.ts +++ b/server/utils/traefik/domain.ts @@ -77,7 +77,7 @@ export const createRouterConfig = async ( const { host, path, https, uniqueConfigKey } = domain; const routerConfig: HttpRouter = { - rule: `Host(\`${host}\`)${path ? ` && PathPrefix(\`${path}\`)` : ""}`, + rule: `Host(\`${host}\`)${path !== null && path !== "/" ? ` && PathPrefix(\`${path}\`)` : ""}`, service: `${appName}-service-${uniqueConfigKey}`, middlewares: [], entryPoints: [entryPoint], From 88a1bee22cf9d70bf9016659c363baa0d62e8f69 Mon Sep 17 00:00:00 2001 From: Lorenzo Migliorero Date: Tue, 30 Jul 2024 14:07:43 +0200 Subject: [PATCH 2/3] feat: exclude vscode settings --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index c2034b77..a94fd277 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +# Editor +.vscode + # Misc .DS_Store *.pem From 1460a667e73799b9b8ad2181fd1854db83529541 Mon Sep 17 00:00:00 2001 From: Lorenzo Migliorero Date: Wed, 31 Jul 2024 21:42:52 +0200 Subject: [PATCH 3/3] fix: revert pkg json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 71c552d1..0c5731d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "dokploy", - "version": "v0.5.0", "private": true, "scripts": { "dokploy:setup": "pnpm --filter=dokploy run setup",