mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-05-10 14:58:27 +00:00
24 lines
557 B
JavaScript
24 lines
557 B
JavaScript
|
//rule scheme :
|
||
|
|
||
|
module.exports = {
|
||
|
|
||
|
replaceResponseStatusCode: function(req,res,statusCode){
|
||
|
//redirect requests toward http://www.taobao.com/*
|
||
|
// to http://www.etao.com
|
||
|
//using 302
|
||
|
|
||
|
if(req.headers.host == "www.taobao.com"){
|
||
|
statusCode = 302;
|
||
|
}
|
||
|
|
||
|
return statusCode;
|
||
|
},
|
||
|
|
||
|
replaceResponseHeader: function(req,res,header){
|
||
|
if(req.headers.host == "www.taobao.com"){
|
||
|
header.location = "http://www.etao.com";
|
||
|
}
|
||
|
|
||
|
return header;
|
||
|
}
|
||
|
};
|