Skip to content

Commit 04cb725

Browse files
Phus LuTooTallNate
Phus Lu
authored andcommitted
Set ALPN to "http 1.1" by default when using tlsproxy
Currently, there're some https/http2 both mode proxies(i.e. goproxy-vps, nghttpx) Offer "ALPN: h2" during connect then send plain http/1.1 request will confuse the https-proxy servers. This issue is similar with curl/curl#1254 Fix it by set `proxy.ALPNProtocols` to `['http 1.1']` by default. Signed-off-by: Phus Lu <[email protected]> Closes #25.
1 parent 9282395 commit 04cb725

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ function HttpsProxyAgent(opts) {
4141
proxy.host = proxy.hostname || proxy.host;
4242
proxy.port = +proxy.port || (this.secureProxy ? 443 : 80);
4343

44+
if (this.secureProxy) {
45+
proxy.ALPNProtocols = proxy.ALPNProtocols || ['http 1.1']
46+
}
47+
4448
if (proxy.host && proxy.path) {
4549
// if both a `host` and `path` are specified then it's most likely the
4650
// result of a `url.parse()` call... we need to remove the `path` portion so

0 commit comments

Comments
 (0)