AnyProxy简单教程

A fully configurable HTTP/HTTPS proxy in NodeJS.

Home page : AnyProxy.io

(Chinese in this doc is nothing but translation of some key points. Be relax if you dont understand.)

特性

  • 支持https明文代理
  • 支持低网速模拟
  • 支持二次开发,可以用javascript控制代理的全部流程,搭建前端个性化调试环境
  • 提供web版界面,观测请求情况
  • 中文主页:http://anyproxy.io

Feature

  • work as http or https proxy
  • fully configurable, you could modify a request at any stage with your customized javascript code
  • when working as https proxy, AnyProxy could intercept https requests for any domain without complaint by browser (after you trust its root CA)
  • a web interface for you to watch realtime request details, where html with (almost) any charset could be shown correctly

Quick Start

step 1 - install

  • install NodeJS
  • npm install -g anyproxy , may require sudo
  • python is optional, it will be OK if you get some error about it during installing.

step 2 - start proxy server

  • start with default settings : anyproxy
  • ...or start with a specific port: anyproxy --port 8001
  • ...start with a rule file: anyproxy --rule ./rule_sample/rule_allow_CORS.js

step 3 - set up proxy settings in your browser , or system ,or mobile devices ,etc

  • default proxy should be 127.0.0.1:8001 , or you_ip_address:8001 on remote devices

step 4 - launch web interface

  • visit http://127.0.0.1:8002 ,you will see realtime requests in your browser
  • be sure to use web interface with modern browsers
screenshot

Rule module

  • Rule module is the specialty for AnyProxy. Think it as a middleware, you could write your own code to hack requests at any stage, no matter it is about to response or the proxy just gets the request. In this way, AnyProxy would be flexible to meet your own demands.

  • It's highly recommended to read this guide before using: What is rule file and how to write one ?

  • There are some samples at ./rule_sample. That may help you a lot when writing your own rule files.

Https features

After configuring rootCA, AnyProxy could help to decrypt https requests, whose approach is also called Man-In-The-Middle(MITM).

A guide about configuring https features is here : https://github.com/alibaba/anyproxy/wiki/v3.x-How-to-config-https-proxy

Others

to save request data
  • to save request data to local file, use anyproxy --file /path/to/file
  • anyproxy uses nedb to save request data. Since NeDB's persistence uses an append-only format, you may get some redundant record in local file. For those dupplicated ones with the same id, just use the lastest line of record.
  • TrafficeRecorder is another tool based on anyproxy to help recording all request data, including header and body. You may have a try.
throttling
  • for instance, anyproxy --throttle 10 sets the speed limit to 10kb/s (kbyte/sec)
  • this is just a rough throttling for downstream, not for network simulation
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,181评论 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 14,602评论 5 6
  • 我已记不清这是多少次独自一人坐在阳台上了,望着马路上时而闪过的三轮车,思绪又逐渐飘远~好友说:只有老人才会像我这样...
    岂敢妄青楼阅读 1,292评论 0 0
  • 又是一年高考时。 现在有一种情况好多了。就是父母们不再那么焦虑了。火辣辣的大日头下,那些望子成龙望女成凤的家长们扒...
    春下春树阅读 1,265评论 0 0
  • 今天看电影《小王子》来着,虽然剧情比较老套幼稚,但它其实给我留下了很深刻的感觉。 有时候也会想,年龄的增加究竟把我...
    问仙何在阅读 1,085评论 0 0

友情链接更多精彩内容