浏览器自带代理服务器配置脚本

Firefox 可以利用代理服务器配置软件来配置代理服务器。其实在浏览器里面可以利用一个标准的代理服务器配置脚本来自己控制代理服务器的使用。比如下面的例子。

function FindProxyForURL(url, host)
    {
        if (isPlainHostName(host) ||
            dnsDomainIs(host, ".netscape.com")||
            dnsDomainIs(host, "docs.google.com")||
            dnsDomainIs(host, "blogger.com")||
            dnsDomainIs(host, ".blogspot.com"))
            return "PROXY 127.0.0.1:3128; DIRECT";
        else
            return "DIRECT";
    }

对 blogger、docs.google.com 等域名使用代理,其他的域名不用代理。

把这个脚本写好以后,在浏览器的代理服务器那里选择 automatic proxy configure file URL: 填入如下的地址

file:///home/hmy/proxy

当然把上面的地址替换成你自己的配置文件路径就成。

Read More:

10 Comments

  1. 1 shellexy Commented @ 2010-02-04 19:40Reply to this comment

    这就是 PAC 自动代理配置脚本呀,

    建议直接用 autoproxy2pac

  2. 2 rainy Commented @ 2010-02-04 20:14Reply to this comment

    07年的时候用过一段时间的自动代理脚本,后来网站被封锁的越来越多,越来越快,维护这样一份列表太累了,就没用了。不过现在的Firefox扩展AutoProxy不错,不用自己维护域名列表了。

  3. 3 icuy Commented @ 2010-02-04 21:19Reply to this comment

    可以直接用这个 http://www.gfwlist.tk 在线版

  4. 4 flytwokites Commented @ 2010-02-04 21:20Reply to this comment

    可惜的是,用pac时remote dns就失效了,导致一些dns被gfw的网站要同时使用host大法,比如twitter。

  5. 5 shellexy Commented @ 2010-02-04 21:34Reply to this comment

    谁说 pac 时 remote dns 失效的, http 代理可就是 remote dns 的。

  6. 6 wsky Commented @ 2010-02-05 1:01Reply to this comment

    Firefox 可以在about:config中设置dns的remote 其他浏览器的话,就需要把socks代理转换成http代理解析DNS Firefox 还是推荐用AutoProxy,很方便很智能

  7. 7 咕噜 Commented @ 2010-02-05 8:45Reply to this comment

    关键是你要装了代理服务器才能翻

  8. 8 ihipop Commented @ 2010-02-05 17:26Reply to this comment

    http://www.heiher.info/?p=1231 这篇文章非常详细的介绍了使用SSHD+Autoproxy自动代理的方法

  9. 9 pink Commented @ 2010-02-06 11:40Reply to this comment

    就是“替换成你自己的配置文件路径”没懂。弱弱的问下自己配置文件路径是怎么做哒?

  10. 10 Sutra Commented @ 2010-02-06 11:48Reply to this comment

    To flytwokites:

    用FoxyProxy加载PAC就可以DNS over proxy了。