node-keepalive-proxy-agent
![JavaScript Style Guide](https://camo.githubusercontent.com/7166bd080fe0035dac8d677ddb7c9f48833c51c4923c609e04a44bdab9f07ebb/68747470733a2f2f63646e2e7261776769742e636f6d2f7374616e646172642f7374616e646172642f6d61737465722f62616467652e737667)
- working keepalive
- option to allow self-signed servers
- basic auth for proxy authentication
- 60 lines of code (100% code coverage)
- only works with https requests (proxy can be http or https)
npm install keepalive-proxy-agent
using the https_proxy or HTTP_PROXY environment variables
let https = require('https')
let Agent = require('keepalive-proxy-agent')
let agent = new Agent ()
let options = {hostname: 'google.de', port: 443, agent: agent}
https.get(options, (resp) => resp.pipe(process.stdout))
...
let agent = new Agent ({proxy:{host:"MYPROXYHOST",port:3128}})
...
connect to self-signed-server over proxy
...
let options = {hostname: 'google.de', port: 443, agent: agent, rejectUnauthorized: false}
...
allow proxy authentication
...
let agent = new Agent ({proxy:{host:"MYPROXYHOST",port:3128, auth:"USER:PASS"}})
...