An open API service indexing awesome lists of open source software.

https://github.com/rafael-vasconcellos/http-connect-proxy-server

a http proxy based on the CONNECT method
https://github.com/rafael-vasconcellos/http-connect-proxy-server

connect http node-js nodejs proxy

Last synced: 7 months ago
JSON representation

a http proxy based on the CONNECT method

Awesome Lists containing this project

README

          

# Usage

```js
const https = require('https');
const { HttpsProxyAgent } = require('https-proxy-agent');

// Configs
const proxyUrl = 'http://user:pass@proxy.example.com:8080'; // replace it with the deployed url
const targetUrl = 'https://www.google.com/';

// Create the HTTP CONNECT agent
const agent = new HttpsProxyAgent(proxyUrl);

// makes the connection through the proxy
https.get(targetUrl, { agent }, (res) => {
console.log(`STATUS: ${res.statusCode}`);
console.log(`HEADERS: ${JSON.stringify(res.headers, null, 2)}`);

res.setEncoding('utf8');
res.on('data', (chunk) => {
console.log('BODY:', chunk);
});

res.on('end', () => {
console.log('Request completed!');
});
}).on('error', (err) => {
console.error('Request Error: ', err.message);
});
```