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
- Host: GitHub
- URL: https://github.com/rafael-vasconcellos/http-connect-proxy-server
- Owner: rafael-vasconcellos
- Created: 2025-05-27T15:29:44.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-08-09T19:57:06.000Z (8 months ago)
- Last Synced: 2025-08-09T21:14:40.385Z (8 months ago)
- Topics: connect, http, node-js, nodejs, proxy
- Language: TypeScript
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
});
```