Skip to content

Commit 7c50e0c

Browse files
authored
fix: allow empty clickhouse passwords (#850)
fixes HDX-1783
1 parent 33d4132 commit 7c50e0c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/api/src/routers/api/clickhouseProxy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,18 @@ const proxyMiddleware: RequestHandler =
123123
const newPath = _req.params[0];
124124
// @ts-expect-error _req.query is type ParamQs, which doesn't play nicely with URLSearchParams. TODO: Replace with getting query params from _req.url eventually
125125
const qparams = new URLSearchParams(_req.query);
126-
if (_req._hdx_connection?.username && _req._hdx_connection?.password) {
126+
127+
if (_req._hdx_connection?.username) {
127128
proxyReq.setHeader(
128129
'X-ClickHouse-User',
129130
_req._hdx_connection.username,
130131
);
132+
}
133+
// Passwords can be empty
134+
if (_req._hdx_connection?.password) {
131135
proxyReq.setHeader('X-ClickHouse-Key', _req._hdx_connection.password);
132136
}
137+
133138
if (_req.method === 'POST') {
134139
// TODO: Use fixRequestBody after this issue is resolved: https://github.com/chimurai/http-proxy-middleware/issues/1102
135140
proxyReq.write(_req.body);

0 commit comments

Comments
 (0)