1 parent 5a8d36b commit 1057676Copy full SHA for 1057676
1 file changed
rule_sample/rule_reverse_proxy.js
@@ -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