A very mini transparent proxy for http/https by NodeJS.Just like squid. 基于nodejs的迷你易用的proxy
A very mini transparent proxy for http/https by NodeJS.Just like squid.
可能是最小最轻量的透明web代理,完美支持http&https。
$ npm install mini-proxy
- 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
- 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.