anyproxy/index.html

222 lines
7.8 KiB
HTML
Raw Normal View History

2014-09-03 16:17:58 +08:00
<html>
2015-08-05 15:44:28 +08:00
<head>
<title>AnyProxy</title>
<link rel="stylesheet" type="text/css" href="./index.css">
2015-08-05 16:48:17 +08:00
<link rel="shortcut icon" type="image/png" href="/favico.png?t=2" />
2015-08-05 15:44:28 +08:00
</head>
<body>
<div class="wrapper">
<a class="cornerBtn" href="https://github.com/alibaba/anyproxy" target="_blank">View on Github</a><br>
<div class="brief">
<div class="logo">
<img src="http://gtms04.alicdn.com/tps/i4/TB1XfxDHpXXXXXpapXX20ySQVXX-512-512.png" width="250" height="250" alt="anyproxy logo" />
</div>
<h2 class="slogan">AnyProxy是一个开放式的HTTP/HTTPS代理你可以灵活控制各种网络数据</h2>
<div class="action">
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>&nbsp;&nbsp;&nbsp;
<iframe src="https://ghbtns.com/github-btn.html?user=alibaba&repo=anyproxy&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
</div>
</div>
<div class="feature">
<div class="featureContent">
<div class="item">
<span class="iconWrapper">
<i class="iconfont">&#xe603;</i>
</span>
<h4>基于Node.js</h4>
<h5>全程JavaScript学习无压力</h5>
</div>
<div class="item">
<span class="iconWrapper">
<i class="iconfont">&#xe601;</i>
</span>
<h4>支持Https</h4>
<h5>用AnyProxy自制根证书明文解析Https请求数据 <a href="https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target="_blank">如何配置&gt;&gt;</a></h5>
</div>
<div class="item">
<span class="iconWrapper">
<i class="iconfont">&#xe600;</i>
</span>
<h4>Web界面</h4>
<h5>多终端共享,可视化观察每个请求</h5>
</div>
<div class="item">
<span class="iconWrapper">
<i class="iconfont">&#xe604;</i>
</span>
<h4>规则逻辑Rule</h4>
<h5>随心所欲编写处理规则,定制我的专属调试工具</h5>
</div>
<div style="clear:both"></div>
</div>
</div>
<div class="quickstart listSection">
<div class="quickstartContent listContent">
<h4 class="subtitle">安装</h4>
<ul>
<li>安装 <a href="http://nodejs.org/" target="_blank">Node.js</a> &gt;= v0.12</li>
<li><code class="simpleBash">npm install -g anyproxy</code>, 可能需要<code class="simpleBash">sudo</code></li>
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">More&gt;&gt;</a></li>
</ul>
<h4 class="subtitle">使用</h4>
<ul>
<li>运行&nbsp;&nbsp;<code class="simpleBash">anyproxy</code></li>
<li>把浏览器http代理指向 127.0.0.1:8001</li>
<li>访问界面http://127.0.0.1:8002 </li>
<li><a href="https://github.com/alibaba/anyproxy#quick-start" target="_blank">更多用法&gt;&gt;</a></li>
</ul>
<a href="https://github.com/alibaba/anyproxy#step-4---launch-web-interface" target="_blank"><img class="screenshot" src="http://gtms01.alicdn.com/tps/i1/TB1IdgqGXXXXXa9apXXLExM2pXX-854-480.gif" width="350"/></a>
</div>
</div>
<div class="sample">
<div class="sampleContent">
<h4 class="subtitle">规则文件(rule)样例</h4>
<div class="item">
<pre>
<code class="javascript">
//remove cache related header
//file : rule_remove_cache_header.js
//rule : anyproxy --rule rule_remove_cache_header.js
module.exports = {
replaceRequestOption : function(req,option){
var newOption = option;
delete newOption.headers['if-modified-since'];
return newOption;
}
};
</code>
</pre>
<span class="figure">
2015-08-05 16:49:49 +08:00
<img src="https://t.alipayobjects.com/images/rmsweb/T1ecFhXjxcXXXXXXXX.png" width="360"/>
2015-08-05 15:44:28 +08:00
</span>
</div>
<div class="item">
<pre>
<code class="javascript">
//append "hello world" to all web pages
//file : rule_replace_response_data.js
//run : anyproxy --rule rule_replace_response_data.js
module.exports = {
replaceServerResDataAsync: function(req,res,serverRes,callback){
if(/html/i.test(res.headers['content-type'])){
var newDataStr = serverRes.toString();
newDataStr += "hello world!";
callback(newDataStr);
}
}
};
</code>
</pre>
<span class="figure">
2015-08-05 16:49:49 +08:00
<img src="https://t.alipayobjects.com/images/rmsweb/T1LcphXf0eXXXXXXXX.png" width="360"/>
2015-08-05 15:44:28 +08:00
</span>
</div>
<div class="item">
<pre>
<code class="javascript">
//assign a specific IP adress for some request
//file : rule_reverse_proxy.js
//run : anyproxy --rule anyproxy --rule rule_reverse_proxy.js
module.exports = {
replaceRequestOption : function(req,option){
var newOption = option;
if(newOption.headers.host == "www.taobao.com"){
newOption.hostname = "192.168.1.3";
newOption.port = "80";
}
return newOption;
}
};
</code>
</pre>
<span class="figure">
2015-08-05 16:49:49 +08:00
<img src="https://t.alipayobjects.com/images/rmsweb/T1hsxhXeddXXXXXXXX.png" width="360"/>
2015-08-05 15:44:28 +08:00
</span>
</div>
<div class="item">
<pre>
<code class="javascript">
//replace all the images with local one
//file : rule_use_local_data.js
//run : anyproxy --rule anyproxy --rule rule_use_local_data.js
var fs = require("fs"),
img = fs.readFileSync("sample.jpg");
module.exports = {
shouldUseLocalResponse : function(req,reqBody){
if(/\.(png|gif|jpg|jpeg)$/.test(req.url)){
req.replaceLocalFile = true;
return true;
}else{
return false;
}
2014-11-26 11:57:05 +08:00
},
2015-08-05 15:44:28 +08:00
dealLocalResponse : function(req,reqBody,callback){
if(req.replaceLocalFile){
callback(200, {"content-type":"image/png"},img );
}
2014-11-26 11:57:05 +08:00
}
};
2015-08-05 15:44:28 +08:00
</code>
</pre>
<span class="figure">
2015-08-05 16:49:49 +08:00
<img src="https://t.alipayobjects.com/images/rmsweb/T1Zr4hXeXhXXXXXXXX.png" width="360"/>
2015-08-05 15:44:28 +08:00
</span>
</div>
<div class="item readmore">
2015-08-05 15:52:20 +08:00
<a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy#%E5%BC%80%E6%94%BE%E5%BC%8F%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%AE%BE%E8%AE%A1" target="_blank">&gt;&gt;&nbsp;规则文件RuleAPI</a>
2015-08-05 15:44:28 +08:00
</div>
</div>
</div>
<div class="readMore listSection">
<div class="listContent">
<h4 class="subtitle">其他特性</h4>
<ul>
<li>Map LocalLog Filter等常规功能</li>
<li><a href="https://github.com/alibaba/anyproxy#throttling">低网速网速模拟</a>调试应用在2G/3G下的表现</li>
<li><a href="https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target="_blank">把AnyProxy作为npm模块做二次开发</a></li>
</ul>
<h4 class="subtitle">相关阅读</h4>
<ul>
<li><a href="https://github.com/alibaba/anyproxy/wiki/%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%96%B0%E8%BD%AE%E5%AD%90%EF%BC%9Aanyproxy" target="_blank">代理服务器的新轮子</a>介绍AnyProxy的设计初衷以及它的开放式设计可以解决什么问题。</li>
<li><a href="http://www.infoq.com/cn/presentations/alipay-hybrid-application-quality-assurance-practice" target="_blank">QCon - 《支付宝hybrid应用质量保证实践》</a>涉及到AnyProxy在测试工程中的应用(By 陈晔)</li>
</ul>
</div>
</div>
<div class="learnMore listSection">
<div class="btnWrapper">
<a class="actionBtn actionBtnWhite" href="https://github.com/alibaba/anyproxy" target="_blank">Read More AnyProxy@Github</a>
</div>
</div>
<div class="footer"></div>
</div>
<link rel="stylesheet" type="text/css" href="./github.css" />
<script src="./lib.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.sample code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
</script>
</body>
</html>