AnyProxy代理服務(wù)器
AnyProxy 是一個(gè)基于 Node.js 的代理服務(wù)器。代理服務(wù)器是個(gè)中間人,站在了客戶端和服務(wù)端中間,雙方通信的每個(gè)比特,都會(huì)滴水不漏地經(jīng)過它。它控制了完整的請(qǐng)求頭、請(qǐng)求體、響應(yīng)頭、響應(yīng)體,可以在客 戶端與服務(wù)端都無感知的情況下介入處理所有的流程。只要代理服務(wù)器可以實(shí)現(xiàn)靈活配置,前端工程師們的奇葩需求就有出頭之日了。
特性:
-
支持 https 明文代理
-
支持低網(wǎng)速模擬
-
支持二次開發(fā),可以用 javascript 控制代理的全部流程,搭建前端個(gè)性化調(diào)試環(huán)境
-
提供web版界面,觀測(cè)請(qǐng)求情況
示例代碼:
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);
評(píng)論
圖片
表情
