UrlList 語法參考資料

本指南說明 Secure Web Proxy 的 UrlList 語法。

UrlList 可讓您建立多個比對項目,以便在多個規則中重複使用。

UrlList 語法支援全網域或網域後置字元比對,以及不含參數或前置路徑的全路徑網址。

支援的萬用字元

UrlList 支援 * 星號萬用字元,可當做前置字元用來比對部分子網域或部分路徑。

如果您提供部分網域,UrlList 只會比對完整的子網域符記。如果未提供路徑分隔符號,則 UrlList 會比對所有路徑。舉例來說,如果您提供 example.com,則 UrlList 會比對 example.com/*,包括網域中的所有路徑。

UrlList 如何解讀項目

Secure Web Proxy 會使用您提供的 UrlList 模式比對網址,並決定是否允許該網址。

UrlList 會依據下列規則解讀項目:

  • 含有英文句號 (.) 和正斜線 (/) 的項目必須是格式正確的網址。您可以使用子網域和路徑萬用字元。第一個 / 字元左側的符記會解讀為頂層網域,例如 google.com/news 中的 .com

  • 含有英文句號 (.) 但不含正斜線 (/) 的項目會視為網域。您可以使用子網域萬用字元。在此情況下,最右邊的符記會視為頂層網域,例如 abc.xyz 中的 .xyz

  • 所有其他項目均無效。

如果 UrlList 模式比對的值含有正斜線 (/),例如 request.url() 中的值,則會依先前說明的方式解譯模式。不過,如果 UrlList 模式比對的值不含 / (例如 host() 中的值),系統只會比對模式的網域部分。

模式比對範例

下表列出模式示例、每個模式的相符網址示例,以及每個模式的不相符網址示例。

模式 相符 不相符
*example.com

example.com/

server.example.com/

sample.server.example.com/

example.com/path

example.com/path?q=query

example.com/path/subpath

sample.server.example.com/path/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

*.example.com

server.example.com/

sample.server.example.com/

sample.server.example.com/path/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

example.com/

example.com/path

example.com/path/subpath

example.com

example.com/

example.com/path

example.com/path/subpath

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

server.example.com/

sample.server.example.com/

sample.server.example.com/path/

*server.example.com

server.example.com/

sample.server.example.com/path

sample.server.example.com/path/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

example.com/

example.com/path

example.com/path/subpath

*example.com/

example.com/

server.example.com/

sample.server.example.com/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

example.com/path/

example.com/path/subpath

sample.server.example.com/path/

*example.com/path*

example.com/path

example.com/path/subpath

sample.server.example.com/path/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

example.com/

server.example.com/

sample.server.com/

*example.com/path/*

example.com/path/subpath

sample.server.example.com/path/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

example.com/

server.example.com/

sample.server.example.com/

example.com/path

*example.com/path/ sample.server.example.com/path/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

example.com/

sample.example.com/

sample.server.example.com/

example.com/path

example.com/path/subpath

example.com/ example.com/

myexample.com/

example.com.bad.com/

us13.altostrat.com/go/example.com/path

www.google.com/search?q=example.com

server.example.com/

sample.server.example.com/

example.com/path

example.com/path/subpath

sample.server.example.com/path/