-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add defaultPort field to the HttpsProxyAgent #43
Conversation
Very nice and clean simple fix. Would it be possible to add a regression test as well? |
@TooTallNate Thanks. The only reliable way I could come up with would be to spawn the |
Yes actually that's perfectly acceptable. Thank you. Merging! |
Published as v2.2.1. |
Note: node-https-proxy-agent works for HTTP over CONNECT, but this change broke it unless you explicitly set 'defaultPort' in the node http client opts? Maybe an example of use for HTTP in the readme?
does not seem to affect ws://... |
Does this change break http proxy as @btsimonh said? My company internal proxy is http, and it worked well with I finally switched to |
This adds a
defaultPort
field to every instance of theHttpsProxyAgent
so that Node's internalhttps.request
does not add the:443
port to theHost
header here.Note: This is different from d7a4c70, which only controls the client's request to the Proxy but not the proxied request to the actual server.
Details: Node's
ClientRequest
checks thedefaultPort
option and the agent'sdefaultPort
and only adds the port to theHost
header of the actual request if it differs from theport
option.agent-base
ensures that this port is always443
(see here). Certain applications, such as the AWS/S3 client, even expect this port number to be absent when signing the HTTP request. Therefore, the port must not be added unless it differs from the default.