Skip to content
Socket-based HTTP proxy for NodeJS
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
LICENSE
README.md
httpproxy.js
proxies-example.js
proxy-example.js

README.md

httpproxy-js

Simple, non-blocking, socket-based NodeJS HTTP proxy.

Example

var httpproxy = require('httpproxy').proxy;

var proxy = new httpproxy({
    host : '127.0.0.1', // default value
    port : 8124         // default value
});

proxy.start();

For starting multiple proxies,

var httpproxy = require('httpproxy').proxy;

var proxies = [];

for (var port=4000; port<4010; port++) {
  proxies.push(
    new httpproxy({
        host : '127.0.0.1',
        port : port
      })
  );
}

proxies.map(function(p) {
    p.start();
  });

When running the proxy, try,

~/$ http_proxy=localhost:8124 curl http://www.yahoo.com -o - 

if you want your terminal filled with junk.

TODO

This is currently a TCP socket proxy with a few HTTP hacks.

  • Separate TCP socket proxy and HTTP proxy
  • Add dynamic event and handler code
  • Respect HTTP codes
  • Add HTTPS

Bitdeli Badge

Something went wrong with that request. Please try again.