From 3eeefb1cab7a705c51115974485a7ee92f665ef9 Mon Sep 17 00:00:00 2001 From: Otto Mao Date: Wed, 4 Mar 2015 10:50:04 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20=E4=BB=A3=E7=90=86=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E7=9A=84=E6=96=B0=E8=BD=AE=E5=AD=90=EF=BC=9Aanyproxy?= =?UTF-8?q?=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 代理服务器的新轮子:anyproxy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/代理服务器的新轮子:anyproxy.md b/代理服务器的新轮子:anyproxy.md index 96b8ed0..10899f6 100644 --- a/代理服务器的新轮子:anyproxy.md +++ b/代理服务器的新轮子:anyproxy.md @@ -76,7 +76,7 @@ AnyProxy规则文件样例 --------------- 以“防止CDN返回304”这个需求为例,最直接的方案是拦截请求,在发送到CDN前删除header中的`if-modified-since`字段。在AnyProxy中,配置replaceRequestOption接口,三行代码就能实现这个自定义功能: -``` +```javascript //rule file module.exports = { //在向服务器发出请求前,AnyProxy会调用这个接口,可以在此时修改发送请求的参数 @@ -89,7 +89,7 @@ module.exports = { 再举个例子,如果你想修改响应数据,在所有html文件最后加个"Hello World",就需要调用`replaceServerResDataAsync`接口,并结合`content-type`字段来进行修改,大约需要8行代码。 -``` +```javascript //rule file module.exports = { replaceServerResDataAsync: function(req,res,serverResData,callback){