Repository navigation
Enable CORS in clickhouse-local by default - #115045
Conversation
`clickhouse-local` can serve HTTP after `SYSTEM START LISTEN HTTP`, but it normally runs without a config file, so it had no `http_options_response` section and answered the CORS preflight with a bare `204` carrying no `Access-Control-*` headers. A browser therefore refuses every cross-origin request to it - including the web UI opened from a `file://` URL, whose origin is `null`. Set the same default `http_options_response` headers that the `clickhouse-server` configuration ships. A configuration file with its own `http_options_response` section still replaces them entirely. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [7c82bdc] Summary: ✅
AI ReviewSummaryThis PR makes PR Metadata
Findings
Tests
Final VerdictRequest changes. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 15/15 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units7 translation units recompiled, 14 s compile time in total, 7 of them have a recent master baseline. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
clickhouse-localcan serve HTTP afterSYSTEM START LISTEN HTTP, but it normally runs without a config file, so it had nohttp_options_responsesection and answered the CORS preflight with a bare204carrying noAccess-Control-*headers. A browser therefore refuses every cross-origin request to it - including the Web UI opened from afile://URL, whose origin isnull.Now
clickhouse-localsets the same defaulthttp_options_responseheaders that theclickhouse-serverconfiguration ships (Access-Control-Allow-Origin: *and friends). A configuration file with its ownhttp_options_responsesection still replaces them entirely, and the headers are sent only for requests that carry anOrigin, exactly as inclickhouse-server.Note the implication, which is now documented next to the existing security warning for the listeners: while an HTTP listener is open, any web page you visit can query the local instance over the loopback address and read the results.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
clickhouse-localnow answers CORS preflight requests with the same permissive headers asclickhouse-server, so the HTTP interface opened bySYSTEM START LISTEN HTTPcan be used from a browser out of the box, including the Web UI opened from afile://URL.Version info
26.8.1.1522(included in26.8and later)