Proxy group types and practical examples
Proxy groups separate a rule's target from the actual outbound route. Rules can point to a group named “Outbound,” so you don't have to rewrite them whenever subscription member names change. When reviewing connection details, follow the same order: check which rule matched, which group it selected, and which member the group actually chose. If the client is in Global or Direct mode, the rules below won't route traffic as expected. Before testing, switch the running mode to rule and make sure the interface hasn't overridden that setting.
Manual selection, latency testing, and fallback order
select lets you choose a group member manually. It's useful for pinning an outbound route and checking members one by one. url-test probes a specified URL and selects an available member based on its response time, making it a good fit for interchangeable routes. fallback uses the first healthy member in the list; it does not compare which one is fastest. If the primary route slows down but still passes the probe, the fallback group may keep using it. When the primary recovers, new connections may return to the first member in the list. These group types differ in how they select a member, not in when the upstream rule matches.
| Type | Selection method | Best for |
|---|---|---|
select | Manual selection | Pinning an outbound route or checking members one by one |
url-test | Probe results and switching tolerance | Choosing a low-latency route from interchangeable members |
fallback | Health status and list order | Failing over new connections in a defined primary-to-backup order |
load-balance | Selecting members according to the chosen load-balancing strategy | Distributing multiple connections across available routes |
Add the example groups and rules to a test configuration, then fill in existing outbound members. The built-in DIRECT is the only member in the probe group, so the configuration loads without a subscription; it only tests direct access and won't provide a proxy route. For actual use, replace the probe group's member with an existing proxy for the same purpose. The name must match exactly. The “Outbound” group includes Direct only for easy comparison. If a type of traffic must use a specific proxy, remove Direct from that group's options and test separately what happens when no member is available.
mode: rule
proxy-groups:
- name: Outbound
type: select
proxies: [Probe Group, DIRECT]
- name: Probe Group
type: url-test
proxies: [DIRECT]
url: https://example.org/
interval: 300
tolerance: 80
rules:
- DOMAIN,example.org,Outbound
- MATCH,DIRECT
Set probe intervals and switching tolerance
interval is the probe interval in seconds; tolerance is the switching threshold for latency-test groups, in milliseconds. Tolerance helps prevent unnecessary switches when probe results are close. Start with an interval of a few minutes and observe the results, then adjust it based on how long you can tolerate waiting after a disconnection. Don't change the probe URL and interval at the same time, or it will be harder to interpret the results. Choose a URL that responds reliably and quickly through each candidate route. A probe only tells you whether that URL responds in time. If a specific service is unavailable, test its DNS resolution, handshake, and response rather than simply shortening the interval.
load-balance distributes connections; it doesn't split a single download across multiple routes. Round-robin works for short connections that don't depend on a fixed source IP. Consistent hashing tends to assign the same kinds of destinations to the same member, though changes to the candidate set can still lead to a different selection. For login sessions, corporate IP allowlists, or services sensitive to source IP, start with a select group and pin a member. To test failover, temporarily make the test primary unavailable, close existing connections, and start a new request. Check whether the backup takes over; don't use an existing browser connection to judge whether switching worked.
Managing rules with rule providers
Rule providers move frequently changing match entries into separate files, leaving the main configuration to define the provider name, how to load it, and which policy to use. rule-providers declares the source. The rules only take effect after you reference the provider in rules with RULE-SET. A rule provider is not a proxy subscription: rule providers define which destinations match, while proxy providers supply available outbound routes. If traffic takes the wrong route, first determine whether the rule list changed or whether the same list was assigned to a different group. Don't change both at once.
Test the rule behavior with a local file first
Use behavior: domain for a list of domains and ipcidr for a list of IP ranges. With classical, entries use typed rules such as DOMAIN-SUFFIX, but don't include an action at the end. The action comes from RULE-SET in the main configuration. format describes the file format, not the matching behavior. YAML files use a payload list; text files don't have that wrapper key. For binary rule sets, also check that your core supports the format and behavior combination.
In this example, work.yaml goes in the rulesets subdirectory of the core's working directory. The two blocks belong in separate files: the main configuration and the rule file. The client's working directory may differ from the location of the configuration you opened manually. If you get a file-not-found error, first check the directory the core actually uses and its read permissions, then verify the filename and capitalization.
mode: rule
rule-providers:
work:
type: file
behavior: classical
format: yaml
path: ./rulesets/work.yaml
rules:
- DOMAIN,docs.example.org,DIRECT
- RULE-SET,work,REJECT
- MATCH,DIRECT
payload:
- DOMAIN-SUFFIX,example.org
This example puts the exact-match exception before the provider rule so you can tell them apart in the logs. Test the exact-match exception and another domain covered by the provider, then check an unrelated destination to confirm the final fallback. The example subdomain doesn't need to host a working site: use the match log to verify the action instead of relying only on whether the site responds. Rules are checked in order, and the first match determines the policy. Moving the exception below the provider or placing MATCH before either one changes the result.
Switch to remote updates while keeping a rollback path
Once the local behavior checks out, use a provider for centralized maintenance by setting type: http, adding the URL of a rule file you're authorized to access, and setting the interval in seconds as recommended by its maintainer. Give each provider its own cache path. Don't reuse a writable path between test and production configurations. Without a cache, an unreachable source is more likely to leave the rules unavailable. With a cache, seeing old rules in the interface doesn't prove that the latest update succeeded. After an update, check the provider's load status, then verify a rule added or removed in that update.
If a download reports success but parsing fails, check whether the response is a login page, a redirect notice, or content that doesn't match the declared format. If updates fail only after switching routes, find out how the client downloads resources and whether the specified outbound route is reachable. Don't make loading the provider a prerequisite for determining how to reach its source. Third-party rule sets can change where traffic goes when they update. Test updates in a copy, review new entries and critical exceptions, and only then replace the production configuration. For node list refresh failures, follow Subscription Errors and Update Intervals; don't change the rule behavior to fix them.
Put domain-based rules before IP rules that trigger destination resolution so you can tell whether traffic matched by name or by address. For IP rules that support no-resolve, the option only prevents an extra lookup for matching that rule. It doesn't prevent apps from making DNS queries or invalidate an address that's already known. If a rule only works for connections made by IP, test once by domain and once by address, check whether the destination address appears in the logs, and then decide whether to keep the option.
Optimizing DNS configuration
DNS configuration first determines where queries go, then whether apps receive real or mapped addresses. With fake-ip, the core returns a virtual address to the app and records the mapping between that address and the domain. With redir-host, the app gets the resolved address, making it a straightforward baseline to observe. Neither mode determines which outbound route traffic uses, and simply enabling dns.enable doesn't take over DNS for every app. The system resolver, browser's encrypted DNS, and the core each have their own entry points. When troubleshooting, identify which one you're testing.
Separate regular queries, bootstrap resolution, and proxy server resolution
nameserver lists the upstream servers for regular queries. To send specific domains to a dedicated resolver, use nameserver-policy to define the scope. For example, send organization-managed internal domains to the organization's resolver instead of a public service. If an upstream is specified by domain name, it must be resolvable first; default-nameserver handles bootstrap resolution for DNS upstreams. If proxy servers are specified by domain name, use proxy-server-nameserver to resolve them independently and avoid a circular dependency where you must connect to a proxy before you can resolve its hostname.
This standalone test uses an IPv4 loopback listener and redir-host. Public resolver IPs make it easy to see where queries go; on networks with organizational policies or other restrictions, use an authorized resolver that's reachable from your current network. listen only opens a local endpoint; it doesn't change system settings. Keep system DNS as-is and check that no other process is using the port. Then verify with client logs or a targeted query before enabling TUN.
dns:
enable: true
listen: 127.0.0.1:1053
enhanced-mode: redir-host
default-nameserver:
- 1.1.1.1
nameserver:
- 1.1.1.1
proxy-server-nameserver:
- 1.1.1.1
nslookup -port=1053 example.org 127.0.0.1
If your version of nslookup supports specifying a server and port, use it to check this listener. If dig is available, you can also run dig @127.0.0.1 -p 1053 example.org A. On timeout, first confirm the listener started and that you're querying the right port. If you get an error response, check upstream reachability or whether a domain policy matched. If only internal domains fail, check the search suffix, the full name actually queried, and whether the dedicated resolver is reachable. Don't replace the main upstream to fix an issue affecting just one domain. After a change, repeat the same query for the same name to avoid inconsistent results from different tools.
Distinguish DNS fallback servers, proxy routes, and caching
In DNS, fallback means another group of upstream resolvers, not a primary-backup proxy group. With fallback configured, conditions such as fallback-filter affect how the core chooses between responses. It doesn't simply mean that a backup is used only when the primary server is completely unreachable. For a setup with one clear upstream, start with a simple configuration. If you need separate handling for internal and public domains, domain-based policies are usually clearer than adding multiple fallback servers. Enabling respect-rules routes DNS upstream connections according to routing rules. Before using it, check that proxy server resolution has a separate path and that the rules don't depend on the same queries they're routing.
Test targeted queries, system-default queries, and in-app queries separately. If a targeted query works but the browser uses a different resolution path, check its Secure DNS settings and whether it reused a cache or existing connection. A browser's DNS test page may show a public recursive resolver selected by the core; seeing a provider name alone doesn't prove the query bypassed the core. To determine the actual path, compare client logs, the current outbound route, and how the app resolves names. For help distinguishing unexpected DNS traffic from expected upstream queries, see How to Test for DNS Leaks.
TUN and fake-IP
TUN is a virtual network interface. When permissions and routing allow it, the client can receive traffic from apps that don't use the system proxy. Traffic entering through the interface still needs a rule to select an outbound route. TUN and fake-IP serve different roles: TUN determines where traffic enters; fake-IP helps the core map a destination address back to its domain. TUN can work with real-address DNS resolution. Apps using fake-IP must send connections back through the same core that holds the mapping, or those virtual addresses have no useful meaning to the system's regular routing.
Intercept traffic first, then DNS
Make a copy of a working regular proxy configuration. Before enabling TUN, check whether the browser and an app that ignores system proxy settings each appear in the connection logs. Then grant the required permissions as prompted by the client and start with a short request. The following Mihomo settings enable traffic interception; the DNS upstream is only a test value. If you already have policies for internal domains, merge them into the same dns mapping instead of adding a second top-level key. Before testing, make sure you know how to stop the service and restore routes, especially if you're using your only remote management connection.
tun:
enable: true
stack: mixed
auto-route: true
auto-detect-interface: true
dns-hijack:
- any:53
- tcp://any:53
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
fake-ip-filter:
- '+.local'
nameserver:
- 1.1.1.1
auto-route sets up the routes needed for traffic interception, while auto-detect-interface identifies the outbound interface. With multiple network adapters, virtual machine bridges, or a corporate VPN, the automatically selected interface may not be the one you expect. Confirm the result on a single network first, then add other interfaces back and compare. The two dns-hijack entries cover traditional UDP and TCP DNS traffic entering TUN; they don't decrypt queries carried over HTTPS or TLS. Check app settings and how their connections are routed to handle encrypted DNS.
| Platform | Check first | Common conflicts |
|---|---|---|
| Windows / macOS | Is the client service ready, and has the system granted permission? | Another VPN or virtual network adapter controlling routes |
| Android / iOS | Is system VPN enabled as prompted by the client? | An existing VPN; desktop clients may not apply YAML fields as written |
| Linux | Can the service access the TUN device and manage routes? | Conflicts with policy routing, container networks, or firewall rules |
Troubleshoot virtual addresses reaching the real network
Confirm that the app's DNS query reached the core, then check whether the returned address is in the example's virtual range. If the app still tries to connect to that address after TUN is disabled, close the old session and have the app resolve the name again. If needed, clear the app or system DNS cache using the platform's usual method. If TUN is on and the app has a virtual address but the domain mapping is missing, check whether another core instance returned the response or whether the mapping disappeared after a configuration change. Don't add the returned virtual address to a static rule as if it were the remote server, and don't assign it to a local device.
Some apps that rely on local network discovery or inspect DNS results work better with real addresses. In the default blacklist mode, names matched by fake-ip-filter receive a real address instead of a fake-IP. This only changes the DNS response; it doesn't allow traffic to bypass the proxy or handle multicast discovery. Find the full domain of the affected app in the logs, add exceptions for only the necessary names, and test its route separately. If your network already uses a range that overlaps the virtual address pool, avoid the conflict and retest DNS and intercepted routes after making changes. Before changing stack, confirm the issue is actually related to the network stack, not permissions, an overlapping subnet, or the wrong outbound interface.
Domain sniffing
Domain sniffing lets the core try to extract a destination name from protocol fields early in a connection, such as the Host header in an HTTP request or the server name visible in a TLS handshake. It can help when a connection reaches the core but only shows an IP address or lacks useful domain information. It isn't a DNS resolver, doesn't require decrypting app data, and can't identify every connection. If traffic never reaches the core or the app only provides an address, check interception settings or IP rules instead of widening the sniffing scope.
Observe first; decide later whether to override the destination
Before testing, record a reproducible connection: the app, destination port, whether it makes a DNS query, and the rule it currently matches. First have the core inspect a small set of common ports and keep the original destination. override-destination is a separate choice from whether to attempt name extraction. When enabled, a sniffed name may become the actual outbound destination rather than being used only for identification and rule matching. For services bound to a specific IP, failover testing, or private DNS checks, keep the original destination initially to avoid resolving the name again and reaching a different server.
sniffer:
enable: true
parse-pure-ip: true
override-destination: false
sniff:
HTTP:
ports: [80, 8080]
TLS:
ports: [443]
skip-domain:
- '+.local'
parse-pure-ip allows the core to try processing IP connections that lack domain information; it doesn't guarantee that every app using an IP provides useful fields. force-dns-mapping applies to traffic with a domain obtained from DNS mapping and can help when name identification is specifically needed. It doesn't force system-wide DNS interception. To control sniffing for known domains, check when to use force-domain and skip-domain. An exclusion by name can't match a connection that had no name when it started. To protect a specific internal service, prefer a clearly defined address or interception scope, and check the exclusion fields supported by your core.
Compare the same request with sniffing on and off
If curl is available and your machine uses TUN, first get the real address of a controlled test service. Then use --resolve to pin that address while keeping the service domain in the URL. This helps distinguish whether the app supplied an address to the network layer from whether the handshake included a server name. The example below queries a public example domain and makes a regular request, which is useful for a first look at connection details. To pin an address for comparison, adapt it to use --resolve with a test service you control. Don't disable TLS certificate verification to create a comparison. Start a fresh connection for each run so a reused session doesn't look like a new sample.
curl --noproxy '*' --head --max-time 10 https://example.org/
If the logs show only an IP, check in order whether the packet reached the core, whether the protocol and port are included in the configuration, and whether the connection already had a domain and therefore didn't trigger another identification attempt. Browsers may use QUIC over HTTP/3; a TLS port entry doesn't also cover QUIC. If you need QUIC, check core support and the relevant protocol setting separately. Encrypted client hello mechanisms can also limit which names are visible. If a name is visible but the connection still matches an IP rule, check rule order and whether the client is showing the original destination, the sniffed name, or the actual outbound address. These fields may differ.
Add sniffing only for problems you can reproduce. One internal service using a nonstandard port isn't a reason to add every UDP and TCP port. Instead, identify its protocol and port, narrow the scope in a copy, and test again. Check another normal connection to make sure it wasn't unexpectedly rerouted. If DNS mapping is already reliable and domain rules match, disabling extra identification can reduce variables. If a connection intentionally targets a specific IP, keep the relevant address rule and document that choice in the override notes.
Local overrides and combining subscriptions
Local overrides keep your rules, DNS exceptions, and port settings separate from subscriptions, so a source refresh doesn't erase your changes. First find out how the client loads configuration: it may import upstream text, apply overrides, then set the mode, ports, or TUN state through the interface. The source file shown in the editor may not be the configuration currently used by the core. When verifying changes, use the client's active configuration or logs if possible. If only one file is visible, add an easy-to-observe test rule to confirm that your changes were actually loaded.
Decide whether each field should replace, prepend, or preserve
YAML describes data; it doesn't define how a client merges two configurations. Whether mappings merge by key or lists are prepended or replaced depends on the client's override mechanism. Repeating rules or dns in the same file doesn't merge them; it may cause an error or leave only the later key. A safer approach is to change one item in a copy through the client, then inspect the final result. Scalar values such as ports and mode can be explicitly replaced. Preserve required existing DNS keys. When inserting exceptions into a rule list, confirm they come before the relevant provider rules and final fallback.
You don't always need to combine entire configurations from multiple sources. For sources already in Mihomo proxy provider format, declare proxy-providers in your own main file and reference them from a proxy group with use. The sources then supply only proxy members; DNS, ports, and rules remain under the main file's control. If you have a complete client configuration, first check whether it can serve as a provider file or needs to be imported separately in the client. Don't use a regular subscription URL as a rule provider, and don't let every top-level setting from source A overwrite those in source B.
Use distinct names for sources, members, and caches
This file-based provider example doesn't assume that you have any particular subscription. Before using it, create the relevant files in the core's working directory. Each file should contain a top-level proxies list, with entries for proxy definitions you're authorized to use and that the core supports. Maintain member names separately in the two files so you can tell where each one came from. If names collide in the same group, resolve the conflict before combining the sources instead of relying on the order shown by the client.
proxy-providers:
office:
type: file
path: ./providers/office.yaml
travel:
type: file
path: ./providers/travel.yaml
proxy-groups:
- name: Manual Outbound
type: select
use: [office, travel]
rules:
- DOMAIN-SUFFIX,example.org,Manual Outbound
- MATCH,DIRECT
With remote providers, give each identifier its own cache path. Sharing a path can let the provider updated later overwrite the earlier provider's content. To limit which members take part in automatic latency testing, open the select group first to check the source members, then narrow the set gradually using the core's filter syntax. If a group is empty, check whether the file loaded, whether the source contains members, and whether the filter excluded them all. Don't add an unplanned Direct fallback just to make the group appear populated; it changes where traffic goes when a subscription fails.
Before deployment, keep two copies for different purposes: one with a recently verified working configuration and another with your overrides and test notes. After refreshing sources, check that rules still reference the right group and that its members still come from the expected source. Then test one exception, one provider rule, and one default rule. Finally, restart the client and confirm that the interface hasn't reverted your saved settings. When running the core directly, use the command below to check the configuration. For relative paths, run it from the same working directory as production, or set the core directory explicitly with -d. A successful config check still doesn't prove that every route is online, so test with actual connections.
mihomo -t -d . -f config.yaml
External controllers
An external controller is an HTTP interface that a client UI or separate dashboard can use to read from and manage the core. It serves a different purpose from a mixed proxy port: proxy ports accept app traffic, while a controller port can report runtime status and may also change policies or reload configuration. If the address is wrong, the dashboard may simply spin forever. First find the actual listening address in the client and check whether another core is already using the same port. Then decide whether to use the built-in connection view or add a separate dashboard.
Start with a loopback listener and read-only requests
The example below binds to the local loopback address only. It doesn't include a sample password. A loopback listener restricts network access, but doesn't isolate the controller from other programs or users on the same machine. On shared devices, machines running untrusted apps, or systems where the controller must stay enabled, add a separate strong secret and store it securely. Check that the port is free before applying the configuration, then start with a read-only request. If you already have authentication configured locally, pass credentials using your own secure input method. Don't paste them into chat, terminal screenshots, or a dashboard URL.
external-controller: 127.0.0.1:9090
curl --noproxy '*' --fail --max-time 5 http://127.0.0.1:9090/configs
curl --noproxy '*' --fail --max-time 5 http://127.0.0.1:9090/proxies
Reading /configs lets you check the core's running mode and some runtime settings; it isn't the original subscription text with comments. Reading /proxies lets you check group names, candidate members, and the current selection. Once both requests succeed, open the client's connection view or dashboard and compare the rule and outbound chain for a new request. If the connection is refused, make sure the service is running and listening on the same address family and port. If the response says you're unauthorized, check the credentials stored by the dashboard. If the response isn't the expected JSON, make sure you're not connected to another local service or a static page.
Distinguish dashboard pages, API endpoints, and browser restrictions
external-ui points to a directory of dashboard static files. With this setting, the core can serve the page at the controller's /ui/ path. If a relative directory doesn't open, first check from the core's working directory that the files exist and that the homepage and static assets are present. Then check whether the client has overridden the setting. If another website hosts the dashboard, the page and local API may have different origins. The browser may also restrict a secure page from accessing a different security context or a private network address. If terminal requests work but the dashboard can't connect, inspect the failure in the browser's network log. Don't expose the controller on every network interface just to troubleshoot.
| Symptom | Check first | Next step |
|---|---|---|
| Local request refused | Process status, port, and address family | Check startup logs for a listener error |
| API reports unauthorized | The instance you're connecting to and dashboard credentials | Check whether the dashboard is still using old settings |
| Command-line requests work, but the browser fails | Same-origin policy, protocol, and local network restrictions | Try the built-in interface or a local same-origin dashboard |
| Dashboard shows unexpected state | Active configuration and existing sessions | Start a new connection and check its group and outbound route |
When you open the page from another device, 127.0.0.1 in the browser refers to that device, not the host running Mihomo. For routine management, use the host's local interface. Don't expose the controller port directly to the public internet, and don't treat the proxy's LAN setting as a controller access-control setting. If you need to manage it from another device, define the access boundary and authentication first, then reach the controller through a trusted management channel. Connection logs may contain internal domains, destination addresses, and app details. Share only the necessary fields when asking for help.
After changing a policy, confirm the new value in the controller, then test with a new request; existing connections may not move. If a setting reverts after restart, determine whether it was a runtime dashboard change, a selection saved by the client, or a persistent override. Wrap up by checking “running mode → matched rule → group member → actual outbound route,” then disable the controller if it doesn't need to stay open. For help finding these views, see A Quick Tour of the Proxies, Profiles, and Logs Pages. For mode selection, return to the mode settings in the guide.