Skip to content

A modern and elegant dashboard for network traffic visualization and analysis.

fix(clickhouse): send reader SQL via POST body instead of URL query param

luoleibac1b9539015
diff --git a/apps/collector/src/modules/clickhouse/clickhouse.reader.ts b/apps/collector/src/modules/clickhouse/clickhouse.reader.ts
index d094e8c..d7d9b64 100644
--- a/apps/collector/src/modules/clickhouse/clickhouse.reader.ts
+++ b/apps/collector/src/modules/clickhouse/clickhouse.reader.ts
@@ -1200,12 +1200,14 @@ ORDER BY rule, chain
try {
const response = await fetch(
- `${baseUrl}/?database=${encodeURIComponent(this.config.database)}&query=${encodeURIComponent(`${query}\nFORMAT JSON`)}`,
+ `${baseUrl}/?database=${encodeURIComponent(this.config.database)}`,
{
method: 'POST',
headers: {
+ 'Content-Type': 'text/plain; charset=utf-8',
...(authHeader ? { Authorization: authHeader } : {}),
},
+ body: `${query}\nFORMAT JSON`,
signal: AbortSignal.timeout(this.config.timeoutMs),
},
);