TooTallNate/node-proxy-agent

defaultPort cannot be read for downstream proxy agents

ohookins opened this issue · 2 comments

In the standard library http client, if an agent is defined, it tries to read the defaultPort of the agent in order to figure out whether or not to append the port number in the final request made to the endpoint (via the agent).

It seems that when using https-proxy-agent via proxy-agent, since this property is defined on https-proxy-agent itself but not dealt with in proxy-agent directly, the standard library http client can't read the property and thus treats any port numbers as "non-standard". Thus we end up with :443 appended to all of our HTTPS URLs. Despite being in the spec, this has proven to break many servers that don't expect it.

I'm not 100% sure on this but it has taken us a few days to get to some reproducible test cases and this seems to be what the problem is. Equally uncertain yet of the solution but thought I'd raise it in case you can rule it out as an issue.

This code in this repository has been moved to the proxy-agents monorepo, so I am closing this pull request. If you feel that this issue still exists as of the latest release, feel free to open a new issue over there.