Docs Config Hosts

hosts

Similar to a system hosts file โ€” points certain domains to a fixed IP, with wildcard support, without needing an actual DNS lookup.

Example Config

config.yaml YAML
hosts:
  '*.clash.dev': 127.0.0.1
  'alpha.clash.dev': '::1'
  test.com: [1.1.1.1, 2.2.2.2]
  baidu.com: google.com
Key (Domain)Wildcards supported

Supports domain wildcards, e.g. *.clash.dev.

Value (Target)String / Array

Can be a single IP, an array of IPs (multiple IPs are returned round-robin), or another domain name to redirect to โ€” though domain redirection doesn't support arrays, only a single value.

Exact domain names take priority over wildcarded ones โ€” for example, foo.example.com takes priority over *.example.com, which in turn takes priority over .example.com.