Skip to content

Commit 0e433a3

Browse files
authored
Merge pull request #689 from Dokploy/canary
v0.11.1
2 parents 819de5a + b08a2f5 commit 0e433a3

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

apps/dokploy/__test__/compose/domain/labels.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe("createDomainLabels", () => {
2626
"traefik.http.routers.test-app-1-web.entrypoints=web",
2727
"traefik.http.services.test-app-1-web.loadbalancer.server.port=8080",
2828
"traefik.http.routers.test-app-1-web.service=test-app-1-web",
29-
"traefik.http.routers.test-app-1-web.rule=PathPrefix(`/`)",
3029
]);
3130
});
3231

@@ -37,21 +36,21 @@ describe("createDomainLabels", () => {
3736
"traefik.http.routers.test-app-1-websecure.entrypoints=websecure",
3837
"traefik.http.services.test-app-1-websecure.loadbalancer.server.port=8080",
3938
"traefik.http.routers.test-app-1-websecure.service=test-app-1-websecure",
40-
"traefik.http.routers.test-app-1-websecure.rule=PathPrefix(`/`)",
4139
]);
4240
});
4341

44-
it("shouldn't add the path prefix if is empty", async () => {
42+
it("should add the path prefix if is different than / empty", async () => {
4543
const labels = await createDomainLabels(
4644
appName,
4745
{
4846
...baseDomain,
49-
path: "",
47+
path: "/hello",
5048
},
5149
"websecure",
5250
);
51+
5352
expect(labels).toEqual([
54-
"traefik.http.routers.test-app-1-websecure.rule=Host(`example.com`)",
53+
"traefik.http.routers.test-app-1-websecure.rule=Host(`example.com`) && PathPrefix(`/hello`)",
5554
"traefik.http.routers.test-app-1-websecure.entrypoints=websecure",
5655
"traefik.http.services.test-app-1-websecure.loadbalancer.server.port=8080",
5756
"traefik.http.routers.test-app-1-websecure.service=test-app-1-websecure",

apps/dokploy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokploy",
3-
"version": "v0.11.0",
3+
"version": "v0.11.1",
44
"private": true,
55
"license": "Apache-2.0",
66
"type": "module",

packages/server/src/utils/docker/domain.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,15 @@ export const createDomainLabels = async (
259259
domain: Domain,
260260
entrypoint: "web" | "websecure",
261261
) => {
262-
const { host, port, https, uniqueConfigKey, certificateType } = domain;
262+
const { host, port, https, uniqueConfigKey, certificateType, path } = domain;
263263
const routerName = `${appName}-${uniqueConfigKey}-${entrypoint}`;
264264
const labels = [
265-
`traefik.http.routers.${routerName}.rule=Host(\`${host}\`)`,
265+
`traefik.http.routers.${routerName}.rule=Host(\`${host}\`)${path && path !== "/" ? ` && PathPrefix(\`${path}\`)` : ""}`,
266266
`traefik.http.routers.${routerName}.entrypoints=${entrypoint}`,
267267
`traefik.http.services.${routerName}.loadbalancer.server.port=${port}`,
268268
`traefik.http.routers.${routerName}.service=${routerName}`,
269269
];
270270

271-
if (domain.path) {
272-
labels.push(
273-
`traefik.http.routers.${routerName}.rule=PathPrefix(\`${domain.path}\`)`,
274-
);
275-
}
276-
277271
if (entrypoint === "web" && https) {
278272
labels.push(
279273
`traefik.http.routers.${routerName}.middlewares=redirect-to-https@file`,

0 commit comments

Comments
 (0)