mirror of
https://github.com/dokploy/dokploy.git
synced 2026-06-14 03:19:49 +00:00
* fix: add tls=true label for compose domains when certificateType is none (#4018) * test: cover tls=true label for certificateType none, require https * fix: scope tls fix to compose labels, leave traefik file config unchanged (#4018)
This commit is contained in:
@@ -103,6 +103,51 @@ describe("createDomainLabels", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should add tls=true for certificateType none on websecure entrypoint", async () => {
|
||||||
|
const noneDomain = {
|
||||||
|
...baseDomain,
|
||||||
|
https: true,
|
||||||
|
certificateType: "none" as const,
|
||||||
|
};
|
||||||
|
const labels = await createDomainLabels(appName, noneDomain, "websecure");
|
||||||
|
expect(labels).toContain(
|
||||||
|
"traefik.http.routers.test-app-1-websecure.tls=true",
|
||||||
|
);
|
||||||
|
// no cert resolver should be set when relying on a default/custom cert
|
||||||
|
expect(labels).not.toContain(
|
||||||
|
"traefik.http.routers.test-app-1-websecure.tls.certresolver=letsencrypt",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not add tls=true for certificateType none on web entrypoint", async () => {
|
||||||
|
const noneDomain = {
|
||||||
|
...baseDomain,
|
||||||
|
https: true,
|
||||||
|
certificateType: "none" as const,
|
||||||
|
};
|
||||||
|
const labels = await createDomainLabels(appName, noneDomain, "web");
|
||||||
|
expect(labels).not.toContain(
|
||||||
|
"traefik.http.routers.test-app-1-web.tls=true",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should add tls=true for certificateType none on a custom https entrypoint", async () => {
|
||||||
|
const noneDomain = {
|
||||||
|
...baseDomain,
|
||||||
|
https: true,
|
||||||
|
customEntrypoint: "websecure-custom",
|
||||||
|
certificateType: "none" as const,
|
||||||
|
};
|
||||||
|
const labels = await createDomainLabels(
|
||||||
|
appName,
|
||||||
|
noneDomain,
|
||||||
|
"websecure-custom",
|
||||||
|
);
|
||||||
|
expect(labels).toContain(
|
||||||
|
"traefik.http.routers.test-app-1-websecure-custom.tls=true",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("should handle different ports correctly", async () => {
|
it("should handle different ports correctly", async () => {
|
||||||
const customPortDomain = { ...baseDomain, port: 3000 };
|
const customPortDomain = { ...baseDomain, port: 3000 };
|
||||||
const labels = await createDomainLabels(appName, customPortDomain, "web");
|
const labels = await createDomainLabels(appName, customPortDomain, "web");
|
||||||
|
|||||||
@@ -337,6 +337,10 @@ export const createDomainLabels = (
|
|||||||
labels.push(
|
labels.push(
|
||||||
`traefik.http.routers.${routerName}.tls.certresolver=${customCertResolver}`,
|
`traefik.http.routers.${routerName}.tls.certresolver=${customCertResolver}`,
|
||||||
);
|
);
|
||||||
|
} else if (certificateType === "none" && https) {
|
||||||
|
// No cert resolver, but HTTPS is enabled (default/custom certificate):
|
||||||
|
// explicitly enable TLS so Traefik serves the router over HTTPS.
|
||||||
|
labels.push(`traefik.http.routers.${routerName}.tls=true`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user