7

我不明白,我尝试将每个 http 请求转发到一个特定的域,除了几个网站。

它有一个例外:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, 
EXCLUDE *.youtube.*"

但我不让它适用于多个域,例如:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, 
EXCLUDE *.youtube.*" *.last.fm"

或者

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, 
EXCLUDE *.youtube.*", *.last.fm"

我的格式错误在哪里?:-/

正如描述(http://peter.sh/experiments/chromium-command-line-switches/#host-rules)所说:

Comma-separated list of rules that control how hostnames are mapped. 
For example: "MAP * 127.0.0.1" --> Forces all hostnames to be mapped to 127.0.0.1 
"MAP *.google.com proxy" --> Forces all google.com subdomains to be resolved to "proxy". 
"MAP test.com [::1]:77 --> Forces "test.com" to resolve to IPv6 loopback. 
Will also force the port of the resulting socket address to be 77. "MAP * baz, EXCLUDE www.google.com" 
--> Remaps everything to "baz", except for "www.google.com". 
These mappings apply to the endpoint host in a net::URLRequest 
(the TCP connect and host resolver in a direct connection, and the CONNECT in an http proxy connection, 
and the endpoint host in a SOCKS proxy connection). 
4

4 回答 4

8

我似乎在回答一个老问题,但无论如何......

您发布了:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, EXCLUDE *.youtube.*", *.last.fm"

我认为您的示例中的引用搞砸了。它应该是:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, EXCLUDE *.youtube.*, *.last.fm"
于 2013-08-21T11:31:32.747 回答
4

除了修复引用错字外,您还应该EXCLUDE在每个排除域之前写:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, EXCLUDE *.youtube.*, EXCLUDE *.last.fm"
于 2018-07-13T21:53:13.670 回答
0

(在 Windows 上)

就我而言,我只有"MAP *.co.za 172.11.12.13"启动 chrome,它忽略了映射。当我添加它的一部分时Exclude google.co.za

回顾:

不工作 :

"/path/to/chrome.exe" --host-rules="MAP *.co.za 172.11.12.13"

有没有工作:

 "/path/to/chrome.exe" --host-rules="MAP *.co.za 172.11.12.13, Exclude google.co.za"
于 2019-07-19T11:26:50.333 回答
0

Windows中,你必须这样写:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, EXCLUDE *.youtube.*","MAP * www.domain.de, EXCLUDE *.last.fm"

注意MAP规则之间没有逗号!

于 2017-01-30T13:46:58.477 回答