TooTallNate / node-http-proxy-agent

An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keepalive support?

mattfysh opened this issue · comments

commented

How can I configure the http proxy agent to support keepalive? including sending the Proxy-Connection: Keep-Alive header?

note - I'm only interested in HTTP traffic and pooling sockets to the proxy server for http-forwarding requests. For https I'm already using https://github.com/mknj/node-keepalive-proxy-agent

Unfortunately, node-agent-base does not handle the keepAlive option for opts, only timeout: https://github.com/TooTallNate/node-agent-base/blob/0288bc26f856dd0473a2923241dfbf1ab67b99b0/src/index.ts#L111

If not, we could do this:

// options can be object: https://github.com/TooTallNate/node-http-proxy-agent/blob/ef184d6b7af42e02920b015ecea557a0ac201fdc/src/index.ts#L15-L18 or url string
const HttpProxyAgent = require('http-proxy-agent')
const agent = new HttpProxyAgent({
      host: 'example.com'
      port: 8080,
      protocol: 'http',
      keepAlive: true
    })

There is this setting, but I'm not sure of the nuances to send a pull request...

This code in this repository has been moved to the proxy-agents monorepo, so I am closing this pull request. If you feel that this issue still exists as of the latest release, feel free to open a new issue over there.