proxy-chain
proxy-chains is Node.js implementation of a proxy server (think Squid) with support for SSL, authentication, upstream proxy chaining, custom HTTP responses and measuring traffic statistics. The authentication and proxy chaining configuration is defined in code and can be dynamic. Note that the proxy server only supports Basic authentication (see Proxy-Authorization for details).
For example, this package is useful if you need to use proxies with authentication in the headless Chrome web browser,
because it doesn't accept proxy URLs such as http://username:password@proxy.example.com:8080
.
With this library, you can set up a local proxy server without any password that will forward requests to
the upstream proxy with password.
Example Use
// Here is an example of how to use the "proxy-chain" library to make an HTTP request through a proxy server:
const proxyChain = require('proxy-chain');
const request = require('request');
const proxyUrl = 'http://proxy.example.com:8080';
const targetUrl = 'http://www.example.com';
(async () => {
const proxiedRequest = await proxyChain.anonymize({url: proxyUrl});
request({url: targetUrl, ...proxiedRequest}, (err, res, body) => {
console.log(body);
});
})();