clickhouse-java
clickhouse-java copied to clipboard
[client-v2] Proxy support
Proxies
There are cases (TBD: list) where client should support sending requests thru proxy. There are two types of proxies we need to consider: http and tcp. First one is a standard facility of HTTP protocol. Java has a built-in support for it. TCP proxy is not so standard thing. What is may be considered as standard is SOCKS. However that type would require a client support (because payload should be injected into proxy protocol for transmission). Proxies commonly used as loadbalancer. Talking about http proxy - some of them are smart and can distribute request based on http headers. Thus it is important to be able to add some custom headers. Some proxies requires to preserve cookies (like F5) to route requests to certain servers.
Note 1: Brief explanation of HTTP proxy (https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling)
Settings
Next existing settings should be ported to the new client:
- com.clickhouse.client.config.ClickHouseClientOption#PROXY_TYPE "Type of proxy can be used to access ClickHouse server. To use an HTTP/SOCKS proxy, you must specify proxy_host and proxy_port."
- com.clickhouse.client.config.ClickHouseClientOption#PROXY_HOST "Set ClickHouse server proxy hostname."
- com.clickhouse.client.config.ClickHouseClientOption#PROXY_PORT "Set ClickHouse server proxy port."
Next settings should be intoroduced:
- client.http.aux_headers - list of custom headers that should be added to outgoing requests.
- client.http.save_cookies - indicator if cookies from server response should be saved
Metrics
Not yet