Closed chrros95 closed 3 months ago
Yeah, sounds fair, that can cause potential side effects on TLS negotiations.
Though, I'll try so scope this within ProxyAgent
instead of directly pointing to connect.js
.
would you like to send a PR to fix that? Do not forget the unit testing 🙂
@metcoder95 Thanks for your advice.
Close this as PR is merged.
Bug Description
When using an encrypted connection for a proxy with the
ProxyAgent
the hostname from the actual request is used instead of the hostname from the proxy URI.Reproducible By
Run the following script and observe that the first client hello contains the hostname of the request URL.
Expected Behavior
Expect is that the first client hello contains the SNI name from proxy.
Logs & Screenshots
Example Output
Environment
undici@6.6.2 node v20.11.1 Pop!_OS 22.04 LTS
Additional context
A hacky workaround that allowed my setup to work, is to ignore the servername from line 91 in the connect.js if the httpSocket is not defined
https://github.com/nodejs/undici/blob/03a2d439dce5a3821f459e490d5edb691cd590a5/lib/core/connect.js#L91-L101