Skip to content

Commit

Permalink
[https-proxy-agent] Support SNI as default for proxy servers (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
unhappychoice committed Aug 23, 2023
1 parent d5cdaa1 commit e625d10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/four-teachers-peel.md
@@ -0,0 +1,5 @@
---
"https-proxy-agent": patch
---

Support SNI for proxy servers
6 changes: 5 additions & 1 deletion packages/https-proxy-agent/src/index.ts
Expand Up @@ -91,7 +91,11 @@ export class HttpsProxyAgent<Uri extends string> extends Agent {
let socket: net.Socket;
if (proxy.protocol === 'https:') {
debug('Creating `tls.Socket`: %o', this.connectOpts);
socket = tls.connect(this.connectOpts);
const servername = this.connectOpts.servername || this.connectOpts.host;
socket = tls.connect({
...this.connectOpts,
servername: servername && net.isIP(servername) ? undefined : servername
});
} else {
debug('Creating `net.Socket`: %o', this.connectOpts);
socket = net.connect(this.connectOpts);
Expand Down

1 comment on commit e625d10

@vercel
Copy link

@vercel vercel bot commented on e625d10 Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.