node-wot icon indicating copy to clipboard operation
node-wot copied to clipboard

[binding-http] Improve proxy support

Open 6d77 opened this issue 5 years ago • 1 comments

The current proxy support in binding-http is rudimentary and does not support some often used scenarios, e.g. https requests over a http proxy as often used in corporate scenarios.

In this case, the client first has to send an unencrypted CONNECT request to the proxy and the use the established connection to setup the TLS encryption and make the https request to the target host.

Such use cases are not directly supported by the http and https packages of nodejs and are therefore also currently not supported by binding-http. See also the (quite old, but apparently still valid) discussion in https://github.com/nodejs/node-v0.x-archive/issues/2474, which was closed, because the issue can be resolved in userland, e.g. as shown in the reply https://github.com/nodejs/node-v0.x-archive/issues/2474#issuecomment-3481078.

Instead of implementing something similar I propose to use the request library. See https://github.com/request/request and https://www.npmjs.com/package/request, which implements all the necessary mechanisms and much more.

6d77 avatar Jun 19 '19 11:06 6d77

Currently, we changed binding-http implementation to use node-fetch which in theory has better support for proxies. Currently, we don't allow configuration of the proxy like here, but we can do it in the future if somebody else has the same use case.

relu91 avatar Dec 15 '23 08:12 relu91