Skip to content

Build your personal knowledge base with Trilium Notes

feat(client): detect communication errors with Traefik

Elian Dorand95450ae07bd
diff --git a/apps/client/src/services/server.ts b/apps/client/src/services/server.ts
index eb5d013824..978aa91ab9 100644
--- a/apps/client/src/services/server.ts
+++ b/apps/client/src/services/server.ts
@@ -275,10 +275,19 @@ async function reportError(method: string, url: string, statusCode: number, resp
});
} else {
const { t } = await import("./i18n.js");
- toastService.showErrorTitleAndMessage(
- t("server.unknown_http_error_title"),
- t("server.unknown_http_error_content", { statusCode, method, url, message: messageStr }),
- 15_000);
+ if (statusCode === 400 && (url.includes("%23") || url.includes("%2F"))) {
+ toastService.showPersistent({
+ id: "trafik-blocked",
+ icon: "bx bx-unlink",
+ title: t("server.unknown_http_error_title"),
+ message: t("server.traefik_blocks_requests")
+ });
+ } else {
+ toastService.showErrorTitleAndMessage(
+ t("server.unknown_http_error_title"),
+ t("server.unknown_http_error_content", { statusCode, method, url, message: messageStr }),
+ 15_000);
+ }
const { throwError } = await import("./ws.js");
throwError(`${statusCode} ${method} ${url} - ${message}`);
}
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index c6f9beaad3..d4619c96a0 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2110,6 +2110,7 @@
},
"server": {
"unknown_http_error_title": "Communication error with the server",
- "unknown_http_error_content": "Status code: {{statusCode}}\nURL: {{method}} {{url}}\nMessage: {{message}}"
+ "unknown_http_error_content": "Status code: {{statusCode}}\nURL: {{method}} {{url}}\nMessage: {{message}}",
+ "traefik_blocks_requests": "If you are using the Traefik reverse proxy, it introduced a breaking change which affects the communication with the server."
}
}