2014-09-03 16:17:58 +08:00
< html >
2015-08-05 15:44:28 +08:00
< head >
2015-08-06 15:36:05 +08:00
< title > AnyProxy< / title >
2015-08-22 14:57:07 +08:00
< link rel = "stylesheet" type = "text/css" href = "/dest/index.css" >
2015-08-06 15:36:05 +08:00
< link rel = "shortcut icon" type = "image/png" href = "/favico.png?t=2" / >
2015-08-17 10:12:01 +08:00
< meta name = "description" content = "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly." >
2015-08-06 15:36:05 +08:00
< meta name = "description" content = "AnyProxy - 开放式的HTTP/HTTPS代理, 你可以灵活控制各种网络数据" >
2015-08-17 10:12:01 +08:00
< meta name = "keywords" content = "代理服务器 Proxy HTTP HTTPS" >
2015-08-06 15:36:05 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" >
2015-08-22 14:57:07 +08:00
< script >
//redirect to Chinese version if in China
if(new Date().getTimezoneOffset() == "-480" & & !(/(cn|en)/i.test(location.href))){
location.href = "/cn";
}else{
var _hmt = _hmt || []; (function() {var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?4e51565b7d471fd6623c163a8fd79e07"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();
}
2015-08-06 16:04:32 +08:00
< / script >
2015-08-05 15:44:28 +08:00
< / head >
< body >
2015-08-06 15:36:05 +08:00
< div class = "wrapper" >
2015-08-22 14:57:07 +08:00
< div class = "cornerBtnWrapper" >
< a href = "/cn" > 中文< / a > |
< a href = "/en" > English< / a > |
< a href = "https://github.com/alibaba/anyproxy" target = "_blank" > View on Github< / a >
< / div >
2015-08-06 15:36:05 +08:00
< 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 >
2015-08-22 14:57:07 +08:00
< h2 class = "slogan" > AnyProxy is a fully configurable http/https proxy in NodeJS, which offers you the ablity to handle http traffic as you wish.< / h2 >
2015-08-06 15:36:05 +08:00
< 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 >
< 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" >
2015-08-22 14:57:07 +08:00
< i class = "iconfont" >  < / i >
2015-08-06 15:36:05 +08:00
< / span >
2015-08-22 14:57:07 +08:00
< h4 > Based on Node.js< / h4 >
2017-02-28 18:06:43 +08:00
< h5 > It' s all javascript and easy to learn.< / h5 >
2015-08-06 15:36:05 +08:00
< / div >
< div class = "item" >
< span class = "iconWrapper" >
< i class = "iconfont" >  < / i >
< / span >
2015-08-22 14:57:07 +08:00
< h4 > HTTPS supported< / h4 >
< h5 > help to decrypted HTTPS data< a href = "https://github.com/alibaba/anyproxy/wiki/HTTPS%E7%9B%B8%E5%85%B3%E6%95%99%E7%A8%8B" target = "_blank" > < br > How to config > > < / a > < / h5 >
2015-08-06 15:36:05 +08:00
< / div >
< div class = "item" >
< span class = "iconWrapper" >
< i class = "iconfont bigger" >  < / i >
< / span >
2015-08-22 14:57:07 +08:00
< h4 > Web UI< / h4 >
< h5 > Web based interface to view requests< / h5 >
2015-08-06 15:36:05 +08:00
< / div >
< div class = "item" >
< span class = "iconWrapper" >
< i class = "iconfont" >  < / i >
< / span >
2015-08-22 14:57:07 +08:00
< h4 > Customed Rule File< / h4 >
< h5 > Make your own debugging tool by writing rule files< / h5 >
2015-08-06 15:36:05 +08:00
< / div >
< div style = "clear:both" > < / div >
< / div >
< / div >
< div class = "quickstart listSection" >
< div class = "quickstartContent listContent" >
2015-08-22 14:57:07 +08:00
< h4 class = "subtitle" id = "install" > Installation< / h4 >
2015-08-06 15:36:05 +08:00
< ul >
2015-08-22 14:57:07 +08:00
< li > install < a href = "http://nodejs.org/" target = "_blank" > Node.js< / a > > = v0.12< / li >
< li > < code class = "simpleBash" > npm install -g anyproxy< / code > , may require< code class = "simpleBash" > sudo< / code > < / li >
2015-08-06 15:36:05 +08:00
< li > < a href = "https://github.com/alibaba/anyproxy#quick-start" target = "_blank" > More> > < / a > < / li >
< / ul >
2015-08-22 14:57:07 +08:00
< h4 class = "subtitle" id = "quickstart" > Quick Start< / h4 >
2015-08-06 15:36:05 +08:00
< ul >
2015-08-22 14:57:07 +08:00
< li > run < code class = "simpleBash" > anyproxy< / code > < / li >
< li > set proxy to 127.0.0.1:8001 on your browser or device< / li >
< li > view web interface at http://127.0.0.1:8002< / li >
< li > < a href = "https://github.com/alibaba/anyproxy#quick-start" target = "_blank" > More Usage > > < / a > < / li >
2015-08-06 15:36:05 +08:00
< / 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" >
2015-08-22 14:57:07 +08:00
< h4 class = "subtitle" id = "sample " > Sample of Rule Files< / h4 >
2015-08-06 15:36:05 +08:00
< div class = "item" >
2015-08-22 14:57:07 +08:00
< h5 class = "itemTitle" > Append " hello world" on HTML response< / h5 >
2015-08-06 15:36:05 +08:00
< pre >
2015-08-05 15:44:28 +08:00
< code class = "javascript" >
2015-08-05 22:11:58 +08:00
//append "hello world" to all web pages
//file : rule_replace_response_data.js
//run : anyproxy --rule rule_replace_response_data.js
2015-08-05 15:44:28 +08:00
module.exports = {
2015-08-05 22:11:58 +08:00
replaceServerResDataAsync: function(req,res,serverRes,cb){
2015-08-05 15:44:28 +08:00
2015-08-05 22:11:58 +08:00
if(/html/i.test(res.headers['content-type'])){
var newDataStr = serverRes.toString();
newDataStr += "hello world!";
cb(newDataStr);
}
2015-08-05 22:03:46 +08:00
}
2015-08-05 15:44:28 +08:00
};
< / code >
2015-08-06 15:36:05 +08:00
< / pre >
< span class = "figure" >
< img src = "https://t.alipayobjects.com/images/rmsweb/T1LcphXf0eXXXXXXXX.png" width = "350" / >
< / span >
< hr / >
< / div >
< div class = "item" >
2015-08-22 14:57:07 +08:00
< h5 class = "itemTitle" > remove if-modified-since from http request header< / h5 >
2015-08-06 15:36:05 +08:00
< pre >
2015-08-05 15:44:28 +08:00
< code class = "javascript" >
2015-08-05 22:11:58 +08:00
//remove cache related header
//file : rule_remove_cache_header.js
//run : anyproxy --rule rule_remove_cache_header.js
2015-08-05 15:44:28 +08:00
module.exports = {
2015-08-05 22:11:58 +08:00
replaceRequestOption : function(req,option){
var newOption = option;
delete newOption.headers['if-modified-since'];
2015-08-05 15:44:28 +08:00
2015-08-05 22:11:58 +08:00
return newOption;
2015-08-05 15:44:28 +08:00
}
};
< / code >
2015-08-06 15:36:05 +08:00
< / pre >
< span class = "figure" >
< img src = "https://t.alipayobjects.com/images/rmsweb/T1ecFhXjxcXXXXXXXX.png" width = "350" / >
< / span >
< hr / >
< / div >
< div class = "item" >
2015-08-22 14:57:07 +08:00
< h5 class = "itemTitle" > assign a specified ip address for some requests< / h5 >
2015-08-06 15:36:05 +08:00
< pre >
2015-08-05 15:44:28 +08:00
< 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 >
2015-08-06 15:36:05 +08:00
< / pre >
< span class = "figure" >
< img src = "https://t.alipayobjects.com/images/rmsweb/T1hsxhXeddXXXXXXXX.png" width = "350" / >
< / span >
< hr / >
< / div >
< div class = "item" >
2015-08-22 14:57:07 +08:00
< h5 class = "itemTitle" > replace all image response by local one< / h5 >
2015-08-06 15:36:05 +08:00
< pre >
2015-08-05 15:44:28 +08:00
< 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 >
2015-08-06 15:36:05 +08:00
< / pre >
< span class = "figure" >
< img src = "https://t.alipayobjects.com/images/rmsweb/T1Zr4hXeXhXXXXXXXX.png" width = "350" / >
< / span >
< / div >
< div class = "readmoreBtn" >
2015-08-22 14:57:07 +08:00
< a href = "https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one" target = "_blank" > > > Ref : Guide of Rule file< / a >
2015-08-06 15:36:05 +08:00
< / div >
< / div >
< / div >
< div class = "readMore listSection" >
< div class = "listContent" >
2015-08-22 14:57:07 +08:00
< h4 class = "subtitle" id = "otherfeature" > Other Features< / h4 >
2015-08-06 15:36:05 +08:00
< ul >
2015-08-22 14:57:07 +08:00
< li > Map file to local , filter your logs< / li >
< li > < a href = "https://github.com/alibaba/anyproxy#throttling" > Simulate a low-speed network< / a > , help to test the performance of your app on poor network< / li >
< li > < a href = "https://github.com/alibaba/anyproxy#work-as-a-module-for-nodejs" target = "_blank" > Using AnyProxy as an npm module< / a > , to deploy your own debugging tools< / li >
< / ul >
2015-08-06 15:36:05 +08:00
< / div >
< / div >
< div class = "learnMore listSection" >
< div class = "btnWrapper" >
< h4 class = "subtitle white" id = "readmore" > Read More< / h4 >
< a class = "actionBtn actionBtnWhite" href = "https://github.com/alibaba/anyproxy" target = "_blank" > https://github.com/alibaba/anyproxy< / a >
< / div >
< / div >
< div class = "footer" > < / div >
< / div >
2015-08-22 14:57:07 +08:00
< link rel = "stylesheet" type = "text/css" href = "/dest/github.css" / >
< script src = "/dest/lib.js" > < / script >
2015-08-06 15:36:05 +08:00
< script type = "text/javascript" >
2015-08-22 14:57:07 +08:00
Zepto(document).ready(function() {
Zepto('.sample code').each(function(i, block) {
2015-08-06 15:36:05 +08:00
hljs.highlightBlock(block);
});
});
< / script >
2015-08-05 15:44:28 +08:00
< / body >
< / html >