delvedor / hpagent

A ready to use http and https agent for working with proxies that keeps connections alive!
MIT License
181 stars 37 forks source link

HTTP2 with hpagent does not work #6

Closed ghost closed 3 years ago

ghost commented 4 years ago

Using got and with http2 set to true, the hpagent does not seem to proxy properly.

Also, hpagent seems to give error 503s whenever a package dependency or the code itself includes an instance of https-proxy-agent here and http2 is set to false in got: https://www.npmjs.com/package/https-proxy-agent

const customAgent = new HttpsProxyAgent({
    keepAlive: true,
    keepAliveMsecs: 10000,
    maxSockets: 256,
    maxFreeSockets: 256,
    scheduling: 'lifo',
    proxy: 'XXX'
});

got(url, {
    http2: true,
    agent: {
        https: customAgent
         }
}
}.catch((err) => {
        console.log(`err.message`);
    })
delvedor commented 3 years ago

Hello! As far as I know, keep alive agents are useless with http2, this agent is intended for HTTP 1.1.

Revadike commented 3 years ago

Any plans to support HTTP 2?