mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
1.fix record issue with https 2.rewrite rule scheme
This commit is contained in:
48
rule_sample/rule_replace_request_option.js
Normal file
48
rule_sample/rule_replace_request_option.js
Normal file
@@ -0,0 +1,48 @@
|
||||
//rule scheme :
|
||||
|
||||
module.exports = {
|
||||
shouldUseLocalResponse : function(req){
|
||||
},
|
||||
|
||||
dealLocalResponse : function(req,callback){
|
||||
},
|
||||
|
||||
replaceRequestOption : function(req,option){
|
||||
//replace request towards http://www.taobao.com
|
||||
// to http://www.taobao.com/about/
|
||||
|
||||
/*
|
||||
option scheme:
|
||||
{
|
||||
hostname : "www.taobao.com"
|
||||
port : 80
|
||||
path : "/"
|
||||
method : "GET"
|
||||
headers : {cookie:""}
|
||||
}
|
||||
*/
|
||||
if(option.hostname == "www.taobao.com" && option.path == "/"){
|
||||
option.path = "/about/";
|
||||
}
|
||||
|
||||
console.log(option);
|
||||
},
|
||||
|
||||
replaceRequestProtocol:function(req,protocol){
|
||||
},
|
||||
|
||||
replaceResponseStatusCode: function(req,res,statusCode){
|
||||
},
|
||||
|
||||
replaceResponseHeader: function(req,res,header){
|
||||
},
|
||||
|
||||
replaceServerResData: function(req,res,serverResData){
|
||||
},
|
||||
|
||||
pauseBeforeSendingResponse : function(req,res){
|
||||
},
|
||||
|
||||
shouldInterceptHttpsReq :function(req){
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user