-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
allow_cors: true
returning two Access-Control-Allow-Origin
he…
…aders (#489) * fix: `allow_cors: true` returning two `Access-Control-Allow-Origin` headers Fixes #93. The `Access-Control-Allow-Origin` was set before on the response before the proxy call, and ClickHouse was returning the response with its own `Access-Control-Allow-Origin` (in my case, "*"). So, having `allow_cors: true` was eventually returning two `Access-Control-Allow-Origin`, one from chproxy and one from ClickHouse. This commit just move the `"Access-Control-Allow-Origin` after the proxy call, overriding the value returned by ClickHouse. If `allow_cors: false`, chproxy does not change the value (so it can be, I believe, any value set by ClickHouse), else, with `allow_cors: true`, it will override to either the value of `Origin` request if any or else `*`. * fix: add tests for allow CORS behavior * fix failing tests * add failing test * fix failing tests * add TODO --------- Co-authored-by: Christophe Kalenzaga <[email protected]>
- Loading branch information
1 parent
d8674fd
commit fb0436c
Showing
3 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
log_debug: true | ||
server: | ||
http: | ||
listen_addr: ":9090" | ||
allowed_networks: ["127.0.0.1/24"] | ||
|
||
users: | ||
- name: "default" | ||
to_cluster: "default" | ||
to_user: "default" | ||
allow_cors: true | ||
|
||
clusters: | ||
- name: "default" | ||
nodes: ["127.0.0.1:18124"] |