diff --git a/crates/dbx-core/src/connection/mod.rs b/crates/dbx-core/src/connection/mod.rs
index 1e1329f93e..5886b2a09d 100644
--- a/crates/dbx-core/src/connection/mod.rs
+++ b/crates/dbx-core/src/connection/mod.rs
@@ -2702,7 +2702,7 @@ impl AppState {
if let Some(database) = self.resolve_legacy_postgres_like_database(connection_id, &db_config).await {
db_config.database = Some(database);
}
- if db_config.db_type != DatabaseType::Plugin {
+ if db_config.db_type != DatabaseType::Plugin && runtime_proxy.is_none() {
probe_connection_endpoint(&db_config, &host, port).await?;
}
if let Err(err) = self.ensure_current_connection_attempt(connection_id, connection_attempt).await {
@@ -2949,12 +2949,13 @@ impl AppState {
DatabaseType::ClickHouse => {
let username = if db_config.username.is_empty() { None } else { Some(db_config.username.clone()) };
let password = if db_config.password.is_empty() { None } else { Some(db_config.password.clone()) };
- let client = db::clickhouse_driver::ChClient::new_with_ca_cert(
+ let client = db::clickhouse_driver::ChClient::new_with_ca_cert_and_proxy(
&url,
username,
password,
Some(&db_config.ca_cert_path),
db_config.url_params.as_deref(),
+ clickhouse_http_proxy(runtime_proxy.as_ref())?,
connect_timeout,
)?;
db::clickhouse_driver::test_connection(&client, connect_timeout).await?;
@@ -3578,6 +3579,11 @@ impl AppState {
if transport_layers.is_empty() || db::sqlite_worker::sqlite_remote_worker_requested(config) {
return Ok(ConnectionEndpoint::direct(config.host.clone(), config.port));
}
+ if config.db_type == DatabaseType::ClickHouse {
+ if let Some(proxy) = self.clickhouse_proxy_for_transport_layers(connection_id, &transport_layers).await? {
+ return Ok(ConnectionEndpoint { host: config.host.clone(), port: config.port, proxy: Some(proxy) });
+ }
+ }
if config.uses_oracle_tns() {
// A TNS descriptor may contain several failover addresses, so rewriting it
// through one local tunnel endpoint would silently break Oracle Net routing.
@@ -3632,6 +3638,43 @@ impl AppState {
Ok(ConnectionEndpoint { host: "127.0.0.1".to_string(), port: local_port, proxy: None })
}
+ async fn clickhouse_proxy_for_transport_layers(
+ &self,
+ connection_id: &str,
+ transport_layers: &[TransportLayerConfig],
+ ) -> Result