Chrome 指定域名解析,绕过 hosts

看到 V站有人问这个,随手一记



Like --host-rules but these rules only apply to the host resolver.
A comma-separated list of rules that control how hostnames are mapped.
For example:
- MAP * Forces all hostnames to be mapped to
- MAP * proxy Forces all subdomains to be resolved to proxy.
- MAP [::1]:77 Forces to resolve to IPv6 loopback. Will also force the port of the resulting socket address to be 77.
- MAP * baz, EXCLUDE Remaps everything to baz, except for

These mappings apply to the endpoint host in a net request (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).


Starting Chrome with --host-resolver-rules="MAP [dead::beef]" where is the hostname to allow resolving and dead::beef is the IPv6 address to resolve it to. net::MappedHostResolver acts at a level before IPv6 connectivity checks, and if a hostname is remapped to an IP literal, connectivity checks do not apply.

还有很多 proxy的参数

curl 的参数



最后一个很有用 😹