You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have set up an http proxy using the http-proxy module and verified it is working using curl.
I am now trying to use hpagent with got to send a request via the proxy. However I am getting a socket hang up error back from got.
My best guess is something to do with how hpagent is creating the connection - hence why I'm raising the issue here. I hope someone can either point out the mistake I have made, or some suggestions on how to track this down further.
I've added a bunch of debug to http-proxy, hpagent and got, but everything looks 'normal'. On the proxy, I do see a socket get created, but the socket gets closed before it reaches any of the proxy code. As far as I can tell, that's happening within the core node.js code - somewhat harder to debug if you're not set up to do so.
To reproduce, the following code creates an HTTP server on port 9000 and the proxy on 8000.
I have the same problem. Tested with multiple proxy agents (hpagent, https-proxy-agent, and simple-proxy-agent) and two request libraries (axios and Node https). Every time, I hit the same issue, but only with a specific domain. I tested the exact same request with HTTPie and it worked fine,
...so that leads me to believe it's a Node.js bug. I've tested on Node v17 and v15.
edit: This issue (nodejs/node#35784) mentions proxy-agent not working in Node v15, yet it reportedly works in Node v14.
Node: v14.16.0
I have set up an http proxy using the
http-proxy
module and verified it is working using curl.I am now trying to use
hpagent
withgot
to send a request via the proxy. However I am getting asocket hang up
error back fromgot
.My best guess is something to do with how
hpagent
is creating the connection - hence why I'm raising the issue here. I hope someone can either point out the mistake I have made, or some suggestions on how to track this down further.I've added a bunch of debug to http-proxy, hpagent and got, but everything looks 'normal'. On the proxy, I do see a socket get created, but the socket gets closed before it reaches any of the proxy code. As far as I can tell, that's happening within the core node.js code - somewhat harder to debug if you're not set up to do so.
To reproduce, the following code creates an HTTP server on port 9000 and the proxy on 8000.
The client code is:
As you can see, it's a fairly default configuration.
With the proxy code running, you can verify that part is working using curl:
But running the
got
code which useshpagent
, you get:The text was updated successfully, but these errors were encountered: