mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix: cert condition
This commit is contained in:
parent
5491653fe9
commit
5aaa1e55f9
@ -77,3 +77,21 @@ test("Should not touch config without host", () => {
|
|||||||
|
|
||||||
expect(originalConfig).toEqual(config);
|
expect(originalConfig).toEqual(config);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Should remove web-secure if https rollback to http", () => {
|
||||||
|
const originalConfig: FileConfig = loadOrCreateConfig("dokploy");
|
||||||
|
|
||||||
|
updateServerTraefik(
|
||||||
|
{ ...baseAdmin, certificateType: "letsencrypt" },
|
||||||
|
"example.com",
|
||||||
|
);
|
||||||
|
|
||||||
|
updateServerTraefik({ ...baseAdmin, certificateType: "none" }, "example.com");
|
||||||
|
|
||||||
|
const config: FileConfig = loadOrCreateConfig("dokploy");
|
||||||
|
|
||||||
|
expect(config.http?.routers?.["dokploy-router-app-secure"]).toBeUndefined();
|
||||||
|
expect(
|
||||||
|
config.http?.routers?.["dokploy-router-app"]?.middlewares,
|
||||||
|
).not.toContain("redirect-to-https");
|
||||||
|
});
|
||||||
|
@ -26,13 +26,13 @@ export const updateServerTraefik = (
|
|||||||
config.http.routers[`${appName}-router-app-secure`] = {
|
config.http.routers[`${appName}-router-app-secure`] = {
|
||||||
...currentRouterConfig,
|
...currentRouterConfig,
|
||||||
entryPoints: ["web-secure"],
|
entryPoints: ["web-secure"],
|
||||||
tls:
|
tls: { certResolver: "letsencrypt" },
|
||||||
admin?.certificateType === "letsencrypt"
|
|
||||||
? { certResolver: "letsencrypt" }
|
|
||||||
: undefined,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
currentRouterConfig.middlewares = ["redirect-to-https"];
|
currentRouterConfig.middlewares = ["redirect-to-https"];
|
||||||
|
} else {
|
||||||
|
delete config.http.routers[`${appName}-router-app-secure`];
|
||||||
|
currentRouterConfig.middlewares = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user