New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxied ClickHouse query POST body is set to empty #570
Comments
@genzgd Thanks, i will take a look. For confirming the issue and , later, the fix, would you mind providing an example request that receives the expected response, and another request that does not work as expected. Appreciate it! |
This curl fails for a ClickHouse origin:
It returns something like
The It should return a list of databases. We've fixed it privately with this code for the params.go:
Not saying it's the best solution, but we don't touch the body unless it's a JSON or form encoded content type |
Thanks for that! |
We're building off of an older commit but I believe this bug still exists. The GetRequestValues function in proxy/params/params.go parses the request body to find certain parameters. There are separate branches for the JSON content type and "everything else" -- and the "everything else" branch tries to parse the body as a form.
Since a ClickHouse POST can include just query text, parsing it as a form returns nothing. When the body is "restored" by SetRequestValues, it is set to the empty string returned by the Form parse, losing the original query text. This breaks all proxied POST requests to ClickHouse.
It seems like GetRequestValues should check for an appropriate content type before parsing the body as a Form, and if it's not a form content type, just return the body string "unmodified"
The text was updated successfully, but these errors were encountered: