-
Notifications
You must be signed in to change notification settings - Fork 30
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
Not working if the http interface is reverse-proxied by nginx with a suffix #164
Comments
I think it is because the HTTP connection is chosen instead of HTTPS: https://github.com/ClickHouse/clickhouse-js/blob/main/src/connection/connection.ts#L74-L81 if it was |
Hi, same problem here. Unfortunately, when you call See: The only solution I've found (besides forking the repo) is to monkey patch the const clickhouseClient = createClient({})
// monkey-patch clickhouseClient.connection.request to force the "pathname" value
let request = clickhouseClient.connection.request
clickhouseClient.connection.request = function (arg0) {
arg0.pathname = "/clickhouse"
return request.apply(this, [arg0])
}
// call clickhouseClient.query A solution would be to allow passing the |
@martoche, you are referring to an issue with the web version; is it correct? For example: const client = createClient({
pathname: '/clickhouse' // defaults to '/'
})
// ### Node.js
// ping -> /clickhouse/ping
// other -> /clickhouse
// ### Web (no specific ping call, it just uses SELECT 1)
// all requests -> /clickhouse |
@slvrtrn Correct, I'm using the web version. The solution you suggest would be perfect! 😍 |
@martoche, 0.2.5 is out with the mentioned changes ^ |
Works great, thank you very much! |
Describe the bug
The http interface of my clickhouse server is reverse-proxied using nignx with suffix.
http://localhost:8123 is mapped to https://my.domain/clickhouse
It's working when http://localhost:8123 is mapped to https://my.domain/ without a suffix.
And when accessing https://my.domain/clickhouse using curl, all works well too.
Steps to reproduce
Expected behaviour
ping() should return true.
Code example
Environment
ClickHouse server
The text was updated successfully, but these errors were encountered: