代理服務器:AnyProxy
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);

本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!