Host-rules google chrome, adding configuration

2019-04-07 18:51发布

i dont get it, i try to forward every http request to a specific domain except a couple of websites.

It is working with one exception:

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

But i dont get it work with multiple domains eg.:

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

or

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

Where is my formatting error? :-/

As the description (http://peter.sh/experiments/chromium-command-line-switches/#host-rules) says:

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). 

3条回答
霸刀☆藐视天下
2楼-- · 2019-04-07 19:10

I appear to be answering an old question, but anyway...

You posted:

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

I think the quoting is messed up in your example. It should be:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, EXCLUDE *.youtube.*, *.last.fm"
查看更多
时光不老,我们不散
3楼-- · 2019-04-07 19:25

Besides fixing quoting typo, you should write EXCLUDE before each excluding domain:

"/path/to/chrome.exe" --host-rules="MAP * www.domain.de, EXCLUDE *.youtube.*, EXCLUDE *.last.fm"
查看更多
淡お忘
4楼-- · 2019-04-07 19:29

In Windows you have to write it this way:

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

Pay attention that there is no comma between the MAP rules!

查看更多
登录 后发表回答