Skip to content

Commit bca6af7

Browse files
committed
fix(traefik): update server configuration to use new host parameter and ensure HTTPS is set correctly
- Modified the updateServerTraefik function to utilize the newHost parameter instead of user.host. - Ensured the HTTPS field is correctly initialized in the test for server configuration.
1 parent e5a3e56 commit bca6af7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/dokploy/__test__/traefik/server/update-server-config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ beforeEach(() => {
7474

7575
test("Should read the configuration file", () => {
7676
const config: FileConfig = loadOrCreateConfig("dokploy");
77-
7877
expect(config.http?.routers?.["dokploy-router-app"]?.service).toBe(
7978
"dokploy-service-app",
8079
);
@@ -84,6 +83,7 @@ test("Should apply redirect-to-https", () => {
8483
updateServerTraefik(
8584
{
8685
...baseAdmin,
86+
https: true,
8787
certificateType: "letsencrypt",
8888
},
8989
"example.com",

packages/server/src/utils/traefik/web-server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const updateServerTraefik = (
1515
user: User | null,
1616
newHost: string | null,
1717
) => {
18-
const { https, host, certificateType } = user || {};
18+
const { https, certificateType } = user || {};
1919
const appName = "dokploy";
2020
const config: FileConfig = loadOrCreateConfig(appName);
2121

@@ -24,7 +24,7 @@ export const updateServerTraefik = (
2424
config.http.services = config.http.services || {};
2525

2626
const currentRouterConfig = config.http.routers[`${appName}-router-app`] || {
27-
rule: `Host(\`${host}\`)`,
27+
rule: `Host(\`${newHost}\`)`,
2828
service: `${appName}-service-app`,
2929
entryPoints: ["web"],
3030
};
@@ -66,7 +66,7 @@ export const updateServerTraefik = (
6666
currentRouterConfig.middlewares = [];
6767
}
6868

69-
if (user?.host) {
69+
if (newHost) {
7070
writeTraefikConfig(config, appName);
7171
} else {
7272
removeTraefikConfig(appName);

0 commit comments

Comments
 (0)