关于学校封锁战网

观察为 UA 过滤

关键字为 “User-Agent: agent/2.8.2.5342\r\n”

➜  ~ curl http://cn.battle.net -H "User-Agent: agent/2.8.2.542\r\n"
curl: (56) Recv failure: Connection reset by peer

更改一下 UA.

➜  ~ curl http://cn.battle.net -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://www.battlenet.com.cn/">here</a>.</p>
</body></html>

解决办法就是本地加个代理, 这里我使用 privoxy, 加上 UA 隐藏参数即可.

加入 hide-user-agent{}

这里直接写入 match-all.action

#vim /usr/local/etc/privoxy/match-all.action

{ \
+change-x-forwarded-for{block} \
+client-header-tagger{css-requests} \
+client-header-tagger{image-requests} \
+client-header-tagger{range-requests} \
+hide-from-header{block} \
+set-image-blocker{pattern} \
+hide-referrer{forge} \
+hide-user-agent{Mozilla/5.0} \
}

然后只需要设定代理至 privoxy 的端口即可.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.