Skip to content

Commit e625d10

Browse files
[https-proxy-agent] Support SNI as default for proxy servers (#237)
1 parent d5cdaa1 commit e625d10

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/four-teachers-peel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"https-proxy-agent": patch
3+
---
4+
5+
Support SNI for proxy servers

packages/https-proxy-agent/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ export class HttpsProxyAgent<Uri extends string> extends Agent {
9191
let socket: net.Socket;
9292
if (proxy.protocol === 'https:') {
9393
debug('Creating `tls.Socket`: %o', this.connectOpts);
94-
socket = tls.connect(this.connectOpts);
94+
const servername = this.connectOpts.servername || this.connectOpts.host;
95+
socket = tls.connect({
96+
...this.connectOpts,
97+
servername: servername && net.isIP(servername) ? undefined : servername
98+
});
9599
} else {
96100
debug('Creating `net.Socket`: %o', this.connectOpts);
97101
socket = net.connect(this.connectOpts);

0 commit comments

Comments
 (0)