Skip to content

[Feature] Add client_protocol_version query parameter to allowed params #552

@ValManP

Description

@ValManP

Is your feature request related to a problem? Please describe.

When attempting to connect to ClickHouse via chproxy using the clickhouse-go driver, the connection fails with the following error:

failed to query server hello: failed to query server hello info: readData: block decode: raw: read str: unexpected EOF

This appears to happen because chproxy does not proxy the client_protocol_version parameter to ClickHouse. As a result, the server and client protocol versions become mismatched, leading to a failed handshake. clickhouse-go client set client_protocol_version parameter here.

Steps to Reproduce:

  1. Run ClickHouse server.

  2. Start chproxy in front of ClickHouse.

  3. Connect via the clickhouse-go driver:

import (
	"database/sql"

	_ "github.com/ClickHouse/clickhouse-go/v2" // Import the ClickHouse driver
)

func main() {
    dsn := `http://chproxy:8123/db?username=USER&password=PASS`
    conn, err := sql.Open("clickhouse", dsn)
    if err != nil {
        panic(err)
    }
    
    if err := conn.Ping(); err != nil {
        panic(err)
    }
}

Describe the solution you'd like

Add client_protocol_version to allowedParams

Describe alternatives you've considered

Workaround: hardcode client_protocol_version in param_groups

param_groups:
  - name: "protocol_version"
    params:
      - key: "client_protocol_version"
        value: "54460"

Additional context

chproxy version v1.28.0
clickhouse-go version v2.40.1
clickhouse version v25.3.6.56

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions