mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-05-30 04:58:27 +00:00
add new rule file
This commit is contained in:
parent
5a8d36b16f
commit
1057676b9b
23
rule_sample/rule_reverse_proxy.js
Normal file
23
rule_sample/rule_reverse_proxy.js
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
read the following wiki before using rule file
|
||||
https://github.com/alibaba/anyproxy/wiki/What-is-rule-file-and-how-to-write-one
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
summary:function(){
|
||||
return "reverse proxy - assign an IP adress for some request";
|
||||
},
|
||||
|
||||
replaceRequestOption : function(req,option){
|
||||
var newOption = option;
|
||||
|
||||
//options : http://nodejs.org/api/http.html#http_http_request_options_callback
|
||||
if(newOption.headers.host == "www.taobao.com"){
|
||||
newOption.hostname = "127.0.0.1";
|
||||
newOption.port = "80";
|
||||
}
|
||||
|
||||
return newOption;
|
||||
}
|
||||
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user