Skip to content
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

Support HTTPS endpoints in NodeCustomAgentConnection #352

Open
ereio opened this issue Nov 8, 2024 · 0 comments · May be fixed by #354
Open

Support HTTPS endpoints in NodeCustomAgentConnection #352

ereio opened this issue Nov 8, 2024 · 0 comments · May be fixed by #354
Labels
bug Something isn't working

Comments

@ereio
Copy link

ereio commented Nov 8, 2024

Describe the bug

When attempting to use a http proxy to then subsequently hit a https Clickhouse endpoint (like Clickhouse Cloud) we get the error:

TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"

This is because there is no conditional to use the correct http(s).request impl for the specified url in NodeCustomAgentConnection.

This problem doesn't exist when not using a custom http_agent due to the code found here

 switch (connection_params.url.protocol) {
    case 'http:':
      return new NodeHttpConnection({
        ...connection_params,
        set_basic_auth_header,
        keep_alive,
      })
    case 'https:':
      return new NodeHttpsConnection({
        ...connection_params,
        set_basic_auth_header,
        keep_alive,
        tls,
      })

If you could put a similar conditional before making the http.request - to use either http.request or https.request implementation based on params.url - in the following line it would solve the problem we're experiencing

@ereio ereio added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant