You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request improves support for HTTP endpoints with custom paths, which is important for scenarios involving reverse proxies or virtual ClickHouse instances. It ensures that endpoint URLs with paths are correctly parsed and preserved in both the core client and JDBC layers. Comprehensive integration tests are added to verify the new behavior.
Core client improvements:
The Client.Builder.addEndpoint method now preserves the full endpoint path (excluding query parameters) when adding endpoints, enabling support for URLs like http://localhost:8123/clickhouse for reverse proxy scenarios.
JDBC layer enhancements:
The JdbcConfiguration.parseUrl method now splits the path into an HTTP path and a database name, ensuring the HTTP path is preserved in the connection URL and the database name is set correctly. For example, /proxy/path/mydb is parsed as httpPath=/proxy/path and database=mydb.
Testing improvements:
Added integration tests in both the core client (HttpTransportTests) and JDBC (ConnectionTest) to verify that endpoint paths are correctly preserved and requests are routed to the correct HTTP paths. These tests simulate reverse proxy scenarios and check that query parameters in the endpoint URL are ignored. [1][2]
Improves handling of HTTP endpoints with custom paths and aligns client and JDBC behavior for reverse proxy scenarios.
Client (client-v2):
Client.Builder now stores Endpoint objects; addEndpoint(String) validates protocol/port and preserves path (e.g., /sales/db).
New/updated transport contracts: Endpoint exposes getURI/getHost/getPort; HttpEndpoint holds host/port/path, builds a path-aware URI, and implements equality/hashCode.
HTTP transport builds requests from Endpoint#getURI(); logs use endpoint object; deprecated getEndpoints() now returns endpoint URIs.
JDBC (jdbc-v2):
JdbcConfiguration splits URL path into HTTP path and database (single segment => database), preserves HTTP path in connection URL, and ignores query params for path.
Tests:
Added integration tests to verify path preservation and routing in both client and JDBC layers; unit tests for HttpEndpoint path/IPv6/encoding; improved assertion messages.
Written by Cursor Bugbot for commit 9d18d4b. This will update automatically on new commits. Configure here.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enhances HTTP endpoint URL handling to support custom paths, enabling reverse proxy scenarios and virtual ClickHouse instances. The changes ensure that path components in endpoint URLs are correctly preserved and parsed throughout the client and JDBC layers.
Key changes:
Modified Client.Builder.addEndpoint to preserve endpoint paths while filtering out query parameters
Updated JdbcConfiguration.parseUrl to split paths into HTTP path and database name components
Added comprehensive integration tests to verify correct path handling in reverse proxy scenarios
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request improves support for HTTP endpoints with custom paths, which is important for scenarios involving reverse proxies or virtual ClickHouse instances. It ensures that endpoint URLs with paths are correctly parsed and preserved in both the core client and JDBC layers. Comprehensive integration tests are added to verify the new behavior.
Core client improvements:
Client.Builder.addEndpointmethod now preserves the full endpoint path (excluding query parameters) when adding endpoints, enabling support for URLs likehttp://localhost:8123/clickhousefor reverse proxy scenarios.JDBC layer enhancements:
JdbcConfiguration.parseUrlmethod now splits the path into an HTTP path and a database name, ensuring the HTTP path is preserved in the connection URL and the database name is set correctly. For example,/proxy/path/mydbis parsed ashttpPath=/proxy/pathanddatabase=mydb.Testing improvements:
HttpTransportTests) and JDBC (ConnectionTest) to verify that endpoint paths are correctly preserved and requests are routed to the correct HTTP paths. These tests simulate reverse proxy scenarios and check that query parameters in the endpoint URL are ignored. [1] [2]Test assertion enhancements:
JdbcConfigurationTestto include the tested URL in error messages for better debugging. [1] [2]Closes [client-v2] Support changing path name in the URL #2344
Checklist
Delete items not relevant to your PR:
Note
Improves handling of HTTP endpoints with custom paths and aligns client and JDBC behavior for reverse proxy scenarios.
Client (client-v2):
Client.Buildernow storesEndpointobjects;addEndpoint(String)validates protocol/port and preserves path (e.g.,/sales/db).EndpointexposesgetURI/getHost/getPort;HttpEndpointholds host/port/path, builds a path-aware URI, and implements equality/hashCode.Endpoint#getURI(); logs use endpoint object; deprecatedgetEndpoints()now returns endpoint URIs.JDBC (jdbc-v2):
JdbcConfigurationsplits URL path into HTTP path and database (single segment => database), preserves HTTP path in connection URL, and ignores query params for path.Tests:
HttpEndpointpath/IPv6/encoding; improved assertion messages.Written by Cursor Bugbot for commit 9d18d4b. This will update automatically on new commits. Configure here.