MozTW 討論區

各項 Mozilla 相關軟體與技術討論
現在的時間是 2024-03-28, 21:05

所有顯示的時間為 UTC + 8 小時





發表新文章 回覆主題  [ 2 篇文章 ] 
發表人 內容
 文章主題 : 請問proxy.pac的寫法
文章發表於 : 2014-08-07, 23:45 
離線

註冊時間: 2014-08-07, 23:40
文章: 1
請問proxy.pac的寫法
是那邊有問題嗎
怎麼特定網站沒有代理呢?
這是之前有人寫好的
最近才在改用怎麼沒有用呢?
路徑是file://C:/proxy.pac
引言回覆:
function FindProxyForURL(url, host)
{


if (dnsDomainIs(host, "www.xiami.co") ||

(dnsDomainIs(host, "www.xiami.com"))

return "PROXY 183.224.1.56:80";


return "DIRECT";
}


回頂端
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.149 Safari/537.36
 個人資料  
引用回覆  
文章發表於 : 2014-08-23, 18:28 
離線

註冊時間: 2008-05-03, 11:00
文章: 78
來自: 硬件浮雲聯萌
http://en.wikipedia.org/wiki/Proxy_auto-config
給了一些有用的鏈接
比如 http://findproxyforurl.com/pac-functions/
引言回覆:

dnsDomainIs

Evaluates hostnames and returns true if hostnames match. Used mainly to match and exception individual hostnames.
代碼:
// If the hostname matches or contains google.com (e.g. maps.google.com, www.google.com),
// send direct to the Internet.

if (dnsDomainIs(host, ".google.com"))
   return "DIRECT";


針對原PO的那個例子
代碼:
function FindProxyForURL(url, host) {
    if (dnsDomainIs(host, ".xiami.co") || dnsDomainIs(host, ".xiami.com")) {
        return "PROXY 183.224.1.56:80";
    }
    return "DIRECT";
}

_________________
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH


回頂端
Opera/9.80 (Windows NT 6.1; Edition Next) Presto/2.12.388 Version/12.17
 個人資料  
引用回覆  
顯示文章 :  排序  
發表新文章 回覆主題  [ 2 篇文章 ] 

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 14 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯您的文章
不能 在這個版面刪除您的文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
cron
Powered by phpBB® Forum Software © phpBB Group
正體中文語系由 竹貓星球 維護製作
© moztw.org, Mozilla Foundation
MozTW,Mozilla 台灣社群