Skip to content
Edit this page

Providers (proxy-providers, rule-providers, inbound-providers)

Providers load proxies, rules, or inbound listeners dynamically from remote HTTP endpoints, local files (with automatic OS filesystem hot-reload watching), or inline definitions.

All local file and cache path values resolve relative to -d and are validated against Safe Paths.


Proxy Providers (proxy-providers)

Supports http and file types (inline is not supported for proxy-providers).

type: http

Key Type Required Default Description
type "http" Yes — Remote HTTP provider.
url string Yes — Valid HTTP(S) URL (fetched directly; proxy and custom header fields are not implemented).
path string No proxy_providers/<md5(url)>.yaml Local cache file path (relative to -d).
interval u64 (seconds) No 86400 (24 hours) Auto-refresh interval (0 disables scheduled fetches).
health-check object No See below Health-check configuration.

type: file

Key Type Required Default Description
type "file" Yes — Local file provider (auto-reloads on file edits via OS watcher with 50 ms debounce).
path string Yes — Local YAML path (relative to -d).
interval u64 (seconds) No 0 (disabled) Optional polling interval.
health-check object No See below Health-check configuration.

health-check

Key Type Default Description
enable bool — Important: ClashRS currently does not check enable; automatic health checks run whenever interval != 0. Set interval: 0 explicitly to disable automatic checks.
url string "http://www.gstatic.com/generate_204" Latency test URL.
interval u64 (seconds) 300 Check interval (0 disables automatic checks).
lazy bool true Defer checks until traffic uses the provider.

Provider File Format

The YAML payload must contain a top-level proxies: list (invalid individual entries log a warning and are skipped):

providers/nodes.yaml
proxies:
  - name: hk-01
    type: ss
    server: hk01.example.com
    port: 8388
    cipher: aes-256-gcm
    password: "password"
config.yaml
proxy-providers:
  remote-sub:
    type: http
    url: "https://sub.example.com/proxies.yaml"
    path: ./providers/remote-sub.yaml
    interval: 3600
    health-check:
      enable: true
      url: http://www.gstatic.com/generate_204
      interval: 300
      lazy: true

  local-nodes:
    type: file
    path: ./providers/nodes.yaml
    health-check:
      interval: 0

Unsupported Mihomo proxy-providers Fields

proxy, header, filter, exclude-filter, exclude-type, override, payload, size-limit, dialer-proxy, health-check.expected-status, and health-check.timeout are not defined.


Rule Providers (rule-providers)

Supports http, file, and inline types; initialized asynchronously in the background.

Behaviors & Formats

  • behavior (required):
  • domain — compiled into a compact DomainSet supporting exact domains, *.example.com (single-level wildcard), .example.com (subdomains only), and +.example.com (domain and all subdomains).
  • ipcidr — compiled into a CidrTrie of IPv4/IPv6 CIDRs.
  • classical — targetless routing rules (TYPE,PAYLOAD[,OPTIONS], nested RULE-SET forbidden), with fast indexes for DOMAIN, DOMAIN-SUFFIX, DOMAIN-KEYWORD, and IP-CIDR (without no-resolve).
  • format (optional, default yaml):
  • yaml — YAML object with a payload: [...] list.
  • text — line-delimited plain text (ignores blank lines and # / // comments).
  • mrs — Mihomo Rule Set binary v1 (Zstandard compressed, MRS\x01); supported for domain and ipcidr only (classical returns an error).

Fields by Type

Type Required Keys Optional Keys & Defaults
http type: http, url, behavior interval (0), path (rules/<md5(url)>), format (yaml), inline-rules / payload (merged for yaml/text)
file type: file, path, behavior interval (None; uses OS file watcher), format (yaml), inline-rules / payload (merged for yaml/text)
inline type: inline, behavior, inline-rules (alias payload) path (rules/<md5(name)>, unused at runtime)
rule-providers:
  ad-domains:
    type: http
    behavior: domain
    format: mrs
    url: "https://rules.example.com/ads.mrs"
    path: ./rules/ads.mrs
    interval: 86400

  lan-cidrs:
    type: file
    behavior: ipcidr
    format: text
    path: ./rules/lan.txt

  custom-inline:
    type: inline
    behavior: classical
    payload:
      - DOMAIN-SUFFIX,internal.example.com
      - IP-CIDR,198.51.100.0/24,no-resolve

Inbound Providers (inbound-providers)

Dynamically loads additional listeners from a local YAML file or remote HTTP endpoint. The payload must contain a top-level listeners: list.

Type Required Keys Optional Keys & Defaults
http type: http, url interval (86400 seconds), path (inbound_providers/<md5(url)>.yaml)
file type: file, path interval (0, disables polling; uses file watcher)

For shadowsocks, anytls, and hysteria2 listeners, updating users inside an inbound provider refreshes user credentials in place without closing the listening socket.

inbound-providers:
  server-users:
    type: file
    path: ./inbounds/users.yaml