diff --git a/apisix/plugins/clickhouse-logger.lua b/apisix/plugins/clickhouse-logger.lua index ef5234b7c8d78..f7b734645334f 100644 --- a/apisix/plugins/clickhouse-logger.lua +++ b/apisix/plugins/clickhouse-logger.lua @@ -95,7 +95,7 @@ local function send_http_data(conf, log_message) .. tostring(port) .. "] " .. err end - if url_decoded.scheme == "https" and conf.ssl_verify then + if url_decoded.scheme == "https" then ok, err = httpc:ssl_handshake(true, host, conf.ssl_verify) if not ok then return false, "failed to perform SSL with host[" .. host .. "] " diff --git a/t/plugin/clickhouse-logger.t b/t/plugin/clickhouse-logger.t index d6999c33a09a0..c4725edbd33bc 100644 --- a/t/plugin/clickhouse-logger.t +++ b/t/plugin/clickhouse-logger.t @@ -41,7 +41,10 @@ add_block_preprocessor(sub { ngx.req.read_body() local data = ngx.req.get_body_data() local headers = ngx.req.get_headers() - ngx.log(ngx.ERR, "clickhouse body: ", data) + ngx.log(ngx.WARN, "clickhouse body: ", data) + for k, v in pairs(headers) do + ngx.log(ngx.WARN, "clickhouse headers: " .. k .. ":" .. v) + end ngx.say("ok") } } @@ -213,4 +216,7 @@ GET /opentracing opentracing --- grep_error_log_out "clickhouse body: INSERT INTO t FORMAT JSONEachRow" +"clickhouse headers: X-ClickHouse-Key:a" +"clickhouse headers: X-ClickHouse-User:default" +"clickhouse headers: X-ClickHouse-Database:default" --- wait: 5