1.1.0 • Published 8 years ago

noelsproxy v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

noelsproxy

A lightning fast and feather-lite HTTP/S proxy


noelsproxy is a completely free and open-source HTTP/S proxy built in Node.js with the intention to be the world's fastest and light-weight proxy possible.

Key Features

Some great Use Cases

Internals

noelsproxy works like most well known proxies such as Squid, Fiddler, Charles Proxy, etc. You can setup timsproxy between a client and Server to intercept both requests and responses. You can also intercept HTTP connects before a HTTPS connection starts.

Install

npm install noelsproxy
var noelsproxy = require('noelsproxy')

require just returns a namespace.

Create an instance

noelsproxy runs two servers, one is a http server and another is a https server. Users need to provide two separate ports on which these servers run. The first argument is the port to be used for the HTTP server and the second argument is for the HTTPS server. All clients only need to change their browser settings to pass traffic to the HTTP server.

// HTTP listens on 1000 and HTTPS listens on 4000. Both listen on 127.0.0.1
// Client browsers pass all traffic to '127.0.0.1:1000'. The port number 4000 is used
// internally
var myProxy = new noelsproxy (1000, 4000) 

Intercepting requests

A great use case here is to enforce safesearch on google. Hitting google images with a wrong search keyword can reveal adult and inappropriate content. This is bad for schools, educational institutions, NGO's and organizations that wish to follow ethical browsing standards.

An easy way to do this, is to use google's safeseach url parameter "&safe=active" and add this to every search request. After request handling, the request can be continued or blocked using the third parameter cb. Use cb.continue (this, req, res) to continue and cb.block(this, req, res) to send 'Blocked' to the browser.

myProxy.on ('onRequest', function (req, res, cb) {
  var self = this;
  if (req.headers.host.match ('google.com') && (req.url != '/') ) {
    req.url += "&safe=active";
  }
  cb.continue(self, req, res)
}

More super examples to come