项目作者: liyangready

项目描述 :
A very mini transparent proxy for http/https by NodeJS.Just like squid. 基于nodejs的迷你易用的proxy
高级语言: JavaScript
项目地址: git://github.com/liyangready/mini-proxy.git
创建时间: 2015-07-25T06:14:45Z
项目社区:https://github.com/liyangready/mini-proxy

开源协议:

关键词:
node-squid proxy squid

下载


mini-proxy

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

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

Installation

  1. $ 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

  1. var MiniProxy = require("mini-proxy");
  2.  
  3. var myProxy = new MiniProxy({
  4. "port": 9393,
  5. "onBeforeRequest": function(requestOptions) {
  6. console.log("proxy request :" + requestOptions.host +
  7. (requestOptions.path || ''));
  8. }
  9. });
  10.  
  11. myProxy.start();
  12. console.log("proxy start at 9393");
  13.  

change system proxy to 127.0.0.1:9393.


it wroks well!
console log:

  1. $ DEBUG=mproxy node demo/test.js
  2. proxy start at 9393
  3. proxy request :www.microsoft.com/pkiops/crl/MicSecSerCA2011_2011-10-18.crl
  4. proxy request :crl.microsoft.com/pki/crl/products/tspca.crl
  5. proxy request :www.baidu.com

Other options

  1. var myProxy = new MiniProxy({
  2. "port": 9393,
  3. "onBeforeRequest": function(requestOptions) {
  4. //u can change the request param here
  5. console.log("proxy request :" + requestOptions.host +
  6. (requestOptions.path || ''));
  7. },
  8. "onBeforeResponse": function(remoteResponse) {
  9. // u can change the response here
  10. },
  11. "onRequestError": function(e, req, res) {}
  12. });

Use DEBUG=mproxy to open error log.