Sitelet https://github.com/alibaba/anyproxy/commit/1057676b9bd1201e768f030830f3f505558ce0de
Skip to content

Commit 1057676

Browse files
committed
add new rule file
1 parent 5a8d36b commit 1057676

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎rule_sample/rule_reverse_proxy.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
read the following wiki before using rule file
3+
https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one
4+
*/
5+
module.exports = {
6+
7+
summary:function(){
8+
return "reverse proxy - assign an IP adress for some request";
9+
},
10+
11+
replaceRequestOption : function(req,option){
12+
var newOption = option;
13+
14+
//options : http://nodejs.org/api/http.html#http_http_request_options_callback
15+
if(newOption.headers.host == "www.taobao.com"){
16+
newOption.hostname = "127.0.0.1";
17+
newOption.port = "80";
18+
}
19+
20+
return newOption;
21+
}
22+
23+
};

0 commit comments

Comments
 (0)