|
1 | 1 | # Programmable HTTP proxy server for Node.js |
2 | 2 |
|
3 | 3 | [](http://badge.fury.io/js/proxy-chain) |
4 | | -[](https://travis-ci.com/apify/proxy-chain) |
5 | 4 |
|
6 | | -Node.js implementation of a proxy server (think Squid) with support for SSL, authentication, upstream proxy chaining, |
7 | | -custom HTTP responses and measuring traffic statistics. |
8 | | -The authentication and proxy chaining configuration is defined in code and can be dynamic. |
9 | | -Note that the proxy server only supports Basic authentication |
10 | | -(see [Proxy-Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization) for details). |
| 5 | +A programmable proxy server (think Squid) with support for SSL/TLS, authentication, upstream proxy chaining, |
| 6 | +custom HTTP responses, and traffic statistics. |
| 7 | +The authentication and proxy chaining configuration is defined in code and can be fully dynamic, giving you a high level of customization for your use case. |
11 | 8 |
|
12 | | -For example, this package is useful if you need to use proxies with authentication |
13 | | -in the headless Chrome web browser, because it doesn't accept proxy URLs such as `http://username:password@proxy.example.com:8080`. |
14 | | -With this library, you can set up a local proxy server without any password |
| 9 | +For example, the proxy-chain package is useful if you need to use headless Chrome web browser and proxies with authentication, |
| 10 | +because Chrome doesn't support proxy URLs with password, such as `http://username:password@proxy.example.com:8080`. |
| 11 | +With this package, you can set up a local proxy server without any password |
15 | 12 | that will forward requests to the upstream proxy with password. |
16 | | -The package is used for this exact purpose by the [Apify web scraping platform](https://www.apify.com). |
| 13 | +For details, read [How to make headless Chrome and Puppeteer use a proxy server with authentication](https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212/). |
17 | 14 |
|
18 | | -To learn more about the rationale behind this package, |
19 | | -read [How to make headless Chrome and Puppeteer use a proxy server with authentication](https://medium.com/@jancurn/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212). |
| 15 | +The proxy-chain package is developed by [Apify](https://apify.com/), the full-stack web scraping and data extraction platform, to support their [Apify Proxy](https://apify.com/proxy) product, |
| 16 | +which provides an easy access to a large pool of datacenter and residential IP addresses all around the world. The proxy-chain package is also used by [Crawlee](https://crawlee.dev/), |
| 17 | +the world's most popular web craling library for Node.js. |
| 18 | + |
| 19 | +Note that the proxy-chain package currently only supports HTTP forwarding and HTTP CONNECT tunneling to forward arbitrary protocols such as HTTPS or FTP ([learn more](https://blog.apify.com/tunneling-arbitrary-protocols-over-http-proxy-with-static-ip-address-b3a2222191ff)). The SOCKS protocol is not supported yet. |
| 20 | +Also, proxy-chain only supports the Basic [Proxy-Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization). |
20 | 21 |
|
21 | 22 | ## Run a simple HTTP/HTTPS proxy server |
22 | 23 |
|
@@ -104,9 +105,9 @@ server.on('requestFailed', ({ request, error }) => { |
104 | 105 | }); |
105 | 106 | ``` |
106 | 107 |
|
107 | | -## A different approach to `502 Bad Gateway` |
| 108 | +## Error status codes |
108 | 109 |
|
109 | | -`502` status code is not comprehensive enough. Therefore, the server may respond with `590-599` instead: |
| 110 | +The `502 Bad Gateway` HTTP status code is not comprehensive enough. Therefore, the server may respond with `590-599` instead: |
110 | 111 |
|
111 | 112 | ### `590 Non Successful` |
112 | 113 |
|
|
0 commit comments