A very mini transparent proxy for http/https by NodeJS.Just like squid. 基于nodejs的迷你易用的proxy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo rename Jul 25, 2015
imgs screenshoot.png Jul 25, 2015
lib rename Jul 25, 2015
README.md Update README.md Sep 16, 2015
index.js rename Jul 25, 2015
package.json rename Jul 25, 2015

README.md

mini-proxy

A very mini transparent proxy for http/https by NodeJS.Just like squid.

可能是最小最轻量的透明web代理,完美支持http&https。

Installation

$ npm install mini-proxy

Features

  • mini.
  • easy to learn and use.
  • support http & https(don't need certificate)
  • support modify request(http&https) and response(http only)

##Usage

var MiniProxy = require("mini-proxy");

var myProxy = new MiniProxy({
	"port": 9393,
	"onBeforeRequest": function(requestOptions) {
		console.log("proxy request :" + requestOptions.host + 
			    (requestOptions.path || ''));
	}
});

myProxy.start();
console.log("proxy start at 9393");

change system proxy to 127.0.0.1:9393.

it wroks well! console log:

$ node demo/test.js
proxy start at 9393
proxy request :www.microsoft.com/pkiops/crl/MicSecSerCA2011_2011-10-18.crl
proxy request :crl.microsoft.com/pki/crl/products/tspca.crl
proxy request :www.baidu.com

###Other options

var myProxy = new MiniProxy({
	"port": 9393,
	"onBeforeRequest": function(requestOptions) {
	//u can change the request param here
		console.log("proxy request :" + requestOptions.host + 
			    (requestOptions.path || ''));
	},
	"onBeforeResponse": function(remoteResponse) {
	// u can change the response here
	},
	"onRequestError": function(e, req, res) {}
});