AnyProxy - 代理服务器


Apache
跨平台
JavaScript

软件简介

AnyProxy 是一个基于 Node.js
的代理服务器。代理服务器是个中间人,站在了客户端和服务端中间,双方通信的每个比特,都会滴水不漏地经过它。它控制了完整的请求头、请求体、响应头、响应体,可以在客
户端与服务端都无感知的情况下介入处理所有的流程。只要代理服务器可以实现灵活配置,前端工程师们的奇葩需求就有出头之日了。

特性:

  • 支持 https 明文代理

  • 支持低网速模拟

  • 支持二次开发,可以用 javascript 控制代理的全部流程,搭建前端个性化调试环境

  • 提供web版界面,观测请求情况

示例代码:

var proxy = require("anyproxy");
//create cert when you want to use https features
//please manually trust this rootCA when it is the first time you run it!
proxy.isRootCAFileExists() && proxy.generateRootCA();var options = {
    type          : "http",
    port          : 8001,
    hostname      : "localhost",
    rule          : require("path/to/my/ruleModule.js"),
    dbFile        : null,  // optional, save request data to a specified file, will use in-memory db if not specified
    webPort       : 8002,  // optional, port for web interface
    socketPort    : 8003,  // optional, internal port for web socket, replace this when it is conflict with your own service
    webConfigPort : 8088,  // optional, internal port for web config(beta), replace this when it is conflict with your own service
    throttle      : 10,    // optional, speed limit in kb/s
    disableWebInterface : false, //optional, set it when you don't want to use the web interface
    silent        : false //optional, do not print anything into terminal. do not set it when you are still debugging.
};new proxy.proxyServer(options);