Skip to content

A very mini transparent proxy for http/https by NodeJS.Just like squid. 基于nodejs的迷你易用的proxy

Notifications You must be signed in to change notification settings

liyangready/mini-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

$ DEBUG=mproxy 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) {}
});

Use DEBUG=mproxy to open error log.

About

A very mini transparent proxy for http/https by NodeJS.Just like squid. 基于nodejs的迷你易用的proxy

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published