Docs Config Rule Providers

Rule Providers

Similar to proxy providers, rule-providers let you dynamically fetch a rule file from an online URL, referenced in your rules with RULE-SET — no need to hand-write hundreds of rules into rules yourself.

Example Config

config.yaml YAML
rule-providers:
  google:
    type: http
    path: ./rule1.yaml
    url: "https://raw.githubusercontent.com/.../Google.yaml"
    interval: 600
    behavior: classical
    format: yaml

rules:
  - RULE-SET,google,PROXY

Field Reference

Key Name (e.g. google)Required

The provider's name — must be unique.

typeRequired

Optional: http/file/inline.

urlRequired when type is http

The rule file's URL.

pathOptional

The save path; if omitted, the URL's MD5 hash is used as the filename, restricted to within HomeDir (extendable via SAFE_PATHS).

intervalOptional

The update interval, in seconds.

proxyOptional

Download/update through a specified proxy.

behaviorRequired

The rule provider's behavior type, which determines how each line in the file is interpreted: domain (a domain list) / ipcidr (an IP range list) / classical (full rule syntax, supporting nearly every type). This must match the actual file format — see Rule Provider Content for the syntax.

formatDefault: yaml

The file format — choose yaml/text/mrs. mrs is a compressed binary format that's smaller and loads faster, but currently only supports the domain/ipcidr behaviors; you can convert to it with mihomo convert-ruleset domain/ipcidr yaml/text XXX.yaml XXX.mrs.

path-in-bundleOptional

If the local file doesn't exist, mihomo will first try extracting the corresponding file from BundleMRS.7z in HomeDir — you can download this archive from meta-rules-dat.

size-limitDefault: 0

The maximum download file size, in bytes; 0 means no limit.

headerOptional

Custom HTTP request headers.

payloadRequired when type is inline

The rule content defined inline.