// MIHOMO · CONFIGURATION REFERENCE

Clash Configuration Guide

config.yaml fields, TUN mode, and rule-based routing

This guide follows mihomo’s configuration structure to help you look up fields, edit settings, and troubleshoot issues. If you don’t yet have a working configuration, start with the installation and setup guide to import a profile, choose a group, and verify connectivity. Then return here for specific settings. Examples use mihomo; available settings in your client depend on its interface and the core it uses.

YAML structure overview

Root mappings, nested mappings, and lists

The root of a configuration file is a mapping: a collection of unique keys. Put mixed-port and mode at the root. The values of dns and tun are nested mappings, while proxies, proxy-groups, and rules are lists. To place a field correctly, first identify whether it belongs at the root, in a section, or in an individual list item. For example, root-level proxies defines proxy nodes; a field with the same name inside a group lists candidates. They are not interchangeable. Pasting a complete node object into a group’s candidate list may produce valid YAML, but it won’t have the field type the core expects.

config.yaml · Standalone direct-connection baseline
mixed-port: 7897
allow-lan: false
mode: rule
log-level: info
proxies: []
proxy-groups:
  - name: Local
    type: select
    proxies:
      - DIRECT
rules:
  - MATCH,Local

This configuration has no remote nodes. Use it to check whether the core can read the file, whether a local port can listen, and whether connection logs show the expected rule and proxy group. MATCH,Local sends connections that match no other rule to Local, whose only built-in candidate is DIRECT. Direct means the core opens the connection itself; it does not hand it off to the system proxy. For a test, configure an app to use the local mixed port explicitly. If the app never sends connections to that port, a successfully loaded configuration won’t produce corresponding connection logs.

Preserve field types when editing

Use spaces for indentation, consistently two per level. A list item’s hyphen marks a new entry; fields such as server and port must align with that item’s name. Write booleans as true or false, and ports as unquoted integers. Quote node names and passwords explicitly if they could be parsed as numbers. Text containing a colon followed by a space, a comment marker, or leading zeros should also be quoted. Don’t rely on your editor to fix indentation in pasted text: some indentation errors change which section a field belongs to without triggering a visible warning.

Keep only one copy of each key at a given level. To add another rule, add a list item under the existing rules key rather than appending a second rules section at the end of the file. Duplicate keys may be rejected or the later value may override the earlier one, depending on the parser. [] is an empty list, {} an empty mapping, and a key with nothing after its colon may be treated as null. These forms are not interchangeable. In particular, don’t use an empty mapping to “preserve” a client-generated section; an override tool may treat it as an explicit new value.

Distinguish the imported profile from the runtime config

A GUI client may store the original subscription, manual settings, and final config passed to the core separately. Before editing, check which profile is active, whether a global override is enabled, and whether you can preview the runtime config. Subscription caches are usually overwritten at the next update, so editing a cache is not a reliable way to keep long-term changes, even if they work for now. On a fresh install, choose a client for your OS on the download page; Clash Plus is a good option. If you already have a client, check which core it uses and where its override settings live. There’s no need to switch clients just to edit one field.

Validate in three stages: first, confirm the YAML parses; next, check that the core recognizes the fields and can resolve every name reference; finally, verify that live connections take the expected route. An “Import successful” message may only mean the file was saved—it doesn’t prove the configuration was activated or that remote connections work. If a subscription update fails, use the subscription parsing checklist to distinguish request failures, unexpected response formats, and indentation errors. Continue checking the configuration structure only after you have valid YAML.

General settings and ports

Choose how apps connect

port provides an HTTP proxy endpoint, socks-port a SOCKS endpoint, and mixed-port accepts both HTTP and SOCKS proxy requests on the same listening port. For a basic setup, you can configure just the mixed port unless an app requires a dedicated port or your operations setup calls for separate ports. Disabling one endpoint is not the same as stopping the core: apps may still connect through another proxy port or TUN. A number in the config also doesn’t guarantee the port is listening. If another program is using it, check the startup log for the bind result before deciding whether to stop that program or change the port.

config.yaml · Local proxy endpoint
mixed-port: 7897
allow-lan: false
mode: rule
log-level: info
ipv6: false

With these settings, set the proxy host in your app to 127.0.0.1 and the port to 7897. Choose HTTP or SOCKS based on the options your app supports. To use the system proxy, give the client the same address in its system proxy settings. Both approaches rely on apps honoring the proxy settings; programs with their own network stack may ignore the system proxy. Whether a browser can open a webpage alone doesn’t tell you which traffic is being captured. On a remote device, 127.0.0.1 points to that device, not the computer running the client.

FieldPurposeCheck after changing
mixed-portListening port shared by HTTP and SOCKSWhether the port set in each app matches
allow-lanWhether devices on the local network can connect to the proxy endpointListening address and firewall exposure
bind-addressAddress to bind to for local network accessWhether the address belongs to this device and is currently available
external-controllerAPI address used by the client or dashboard to manage the coreWhether the management endpoint is exposed only on intended interfaces

Keep allow-lan: false if you only use the proxy on this device. If you need to share it on your local network, identify the serving network interface first, then consider bind-address and the firewall’s inbound rules. Don’t expose every interface to untrusted networks just because your phone can’t connect. A proxy listener and a management API are separate things. Putting the control API port in a browser’s proxy settings won’t forward traffic or tell you whether a node is healthy. If the client manages the control API automatically, you usually don’t need to add it to the subscription config. See mixed ports and local network sharing for details.

Runtime modes and logs

mode: rule selects an outbound based on the rules list. global uses a global policy selection instead of routing each connection by the existing rules. direct sends connections that enter the core directly to their destination. The mode determines what happens after traffic reaches the core; it doesn’t route app traffic into it. If the browser works but the terminal doesn’t, first check whether the terminal is using a proxy endpoint. Don’t start by changing rules. If every connection in the log takes the same route, check the current mode before investigating rule order or the selected proxy group.

log-level: info is suitable for routine checks of startup and connection status. To investigate an issue, temporarily switch to debug, reproduce it with a single request, note where the failure occurs, then restore the previous level. Logs may include domains, local network addresses, and node labels that reveal details about your setup; review them before sharing. Another common misconception is that root-level ipv6 acts as an operating system switch. It controls behavior related to the core; it won’t disable IPv6 on the system’s network adapters or force connections that bypass the core to use IPv4. Check DNS address-family preferences separately in the next section.

After changing ports, test an explicit proxy with a single app while TUN and local network sharing are disabled. Then enable other endpoints one at a time. If explicit proxying works but connections fail only after TUN is enabled, you can narrow the issue to traffic capture, routing, or DNS instead of suspecting the node, config syntax, and system permissions all at once.

DNS and fake-IP

Understand the three types of DNS lookups

dns.enable enables mihomo’s built-in DNS service, but it doesn’t mean the system sends every DNS lookup to it. Distinguish the domain an app wants to visit, the hostname of a proxy node’s server, and the hostname of an upstream resolver such as a DoH service. Regular destination domains usually use nameserver. Use proxy-server-nameserver to specify a separate resolver for proxy server hostnames. default-nameserver is mainly used to resolve the hostname of an upstream DNS service. Treating all three as requests to “the same upstream” makes it harder to tell whether a website failed to resolve or the node’s address was never resolved in the first place.

config.yaml · fake-IP and upstream DNS
dns:
  enable: true
  listen: 127.0.0.1:1053
  ipv6: false
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter:
    - 'localhost'
    - '+.lan'
  default-nameserver:
    - 1.1.1.1
  nameserver:
    - https://dns.google/dns-query
  proxy-server-nameserver:
    - 1.1.1.1

This example uses a local listening address and public resolvers to show how the fields fit together. In a real setup, use upstreams that are reachable on your network and comply with its policies. If the node server’s hostname must be resolved before it can connect, its bootstrap lookup can’t depend on the same proxy connection that hasn’t been established yet. A separate proxy-server-nameserver can split those steps, but only if that resolver is reachable. Trace the relevant DNS requests only when the node address is a hostname. If the node address is already an IP, check address and port reachability first when a connection times out.

Why fake-IP returns reserved addresses

enhanced-mode: fake-ip assigns temporary addresses to domains and keeps a mapping between each domain and its temporary address in the core. When an app connects to that address and the connection returns to the same core, the core can recover the domain and apply domain-based rules. Seeing 198.18.x.x in a lookup tool doesn’t mean the upstream resolver returned that address for the website. Conversely, if the system receives a fake-IP but the connection isn’t routed back through the core, it may try connecting directly to a reserved address and time out. When switching configs, pausing TUN, or restarting the core, also check whether apps are reusing old cached addresses.

fake-ip-filter works by excluding names that shouldn’t receive temporary addresses. Exclusion only prevents fake-IP assignment; it doesn’t automatically send the name to a local network resolver. For example, if a local domain suffix needs to be resolved internally, configure nameserver-policy for your environment and make sure the specified upstream is reachable. Printer and screen-casting discovery also relies on more than ordinary DNS. If multicast-based discovery fails, don’t assume fake-IP is the cause. If an app really needs a real address, first add a narrowly scoped exclusion for the domains it uses, then check the result.

Troubleshoot DNS leaks and resolution failures

Compare two lookup paths for the same domain: query the local listening port directly, then query through the path the app normally uses. If the first works but the second fails, investigate system DNS, the browser’s Secure DNS setting, or TUN capture. If both fail, check whether the upstream timed out, whether its hostname resolved during bootstrap, and whether the current network can reach the configured resolver. Enabling DoH changes only the transport for the DNS path configured to use it; it doesn’t replace the DNS entry points used by other apps. A website’s reported resolver only reflects that particular test and doesn’t prove that every process on the system uses the same path.

After disabling dns.ipv6, run a new lookup and check whether the core still returns a usable AAAA record to the app. Don’t judge the result from an existing webpage connection or cached response. If the resolver returns the expected address but the connection still fails, shift your checks to the traffic entry point, routing, and rules. If you use per-domain upstream policies, test at least one regular site and one internal domain so fixing public DNS doesn’t break internal services.

TUN routing and traffic capture

Virtual adapters, routes, and interface selection

TUN is useful for apps that don’t honor the system proxy. It receives IP traffic through a virtual network adapter and routes instead of requiring apps to connect to an HTTP or SOCKS port. tun.enable requests that this entry point be enabled, auto-route lets the core configure capture routes using the platform’s supported method, and auto-detect-interface helps select the actual outbound interface. These fields control the device, inbound path, and outbound interface respectively; they are not three equivalent switches. Seeing a virtual adapter in the system’s network list doesn’t prove that it is receiving the connections you want to capture.

config.yaml · TUN capture snippet
tun:
  enable: true
  stack: mixed
  auto-route: true
  auto-detect-interface: true
  dns-hijack:
    - 'any:53'
    - 'tcp://any:53'

Use this snippet alongside a working DNS section. any:53 covers standard UDP DNS requests. The explicit tcp://any:53 entry covers TCP DNS requests that enter through the capture path. These lines don’t promise to intercept all traffic on every network interface. They don’t cover requests that never enter the capture path, DoH or DoT used by an app, or local lookups sent over special paths on some platforms. Don’t change this format to an arbitrary port as a substitute for configuring an app’s Secure DNS settings.

Stack options and platform permissions

Available values for stack depend on the core. Common options in mihomo are system, gvisor, and mixed. With mixed, TCP uses the system stack and UDP uses the gVisor stack. Changing the stack changes how traffic is handled after entering TUN; it won’t grant missing network adapter permissions or add UDP forwarding to a proxy node that doesn’t support it. If only one protocol fails, compare the same app and destination, identify whether the problem starts at capture, stack handling, or remote egress, then change one setting at a time.

PlatformCheck before enablingWhere to start troubleshooting
Windows desktopWhether the client requires service mode or administrator privilegesAdapter creation, route conflicts, and service status
macOS desktopWhether the client’s network authorization or helper service is readySystem prompts, service startup logs, and the current outbound interface
LinuxWhether the running process can access the TUN device and modify routesDevice permissions, network namespaces, and routing tables
Android / iOSWhether the client’s system VPN authorization is validConflicts with existing VPNs and the settings supported by the client

A GUI client may update routes through a service process rather than directly from its main window. If the switch immediately turns itself off, or the log reports that device creation failed, start by checking the client service and system permissions instead of repeatedly changing stack. On macOS, prompts for network access, Keychain access, and helper services relate to different actions. See macOS permission prompts explained to identify each one. Mobile clients typically use the system VPN interface, so don’t assume editing desktop fields will change what traffic a mobile client captures.

Use comparison tests to find gaps in traffic capture

First, disable TUN and verify that a basic connection works through the mixed port. Then disable the test app’s proxy settings and enable only TUN. Have the same app open a new connection. If the connection log doesn’t change at all, check system routes, the app’s network namespace, other VPNs, and network adapter priority. If a connection appears but uses the wrong outbound, investigate proxy groups and rules. Close existing app connections before testing; connection reuse can make new settings appear ineffective. Verify successful connections in the core’s logs too—the app may have bypassed the intended entry point.

When Ethernet and Wi-Fi are both connected, a change in access point may cause automatic detection to select a different outbound interface. Check the default route and the interface recognized by the core before deciding whether to pin the interface; hard-coding it can make the setup fail when the device changes networks. If local network resources become unreachable after enabling TUN, first determine whether private IP traffic is being captured incorrectly or whether the problem is DNS, multicast, or the return route. On remotely managed machines, have a separate console or a clear rollback path ready so a route change doesn’t cut off access to the host.

Proxy fields

Define a reusable proxy node by protocol

proxies defines outbound proxy nodes. Each entry needs at least a recognizable name, a protocol type, a destination server, and a port. Other fields depend on the protocol. The name is an internal reference and doesn’t have to match the server’s hostname. The server field is usually a hostname or IP, without a protocol prefix or path. port is the remote listening port, not the local mixed port. Whenever a node is referenced, keep its name—including spaces, parentheses, and capitalization—exactly consistent. Otherwise, a group may appear to contain a matching node while the core can’t find it.

config.yaml · Shadowsocks and SOCKS5 node structure
proxies:
  - name: Lab-SS
    type: ss
    server: ss.example.com
    port: 8388
    cipher: aes-128-gcm
    password: "example-password"
    udp: true
  - name: Lab-SOCKS
    type: socks5
    server: 127.0.0.1
    port: 1080
    udp: false

The first entry uses an example hostname and a dummy password to illustrate the structure; to connect, replace them with the access details for a service you’re authorized to use and its required encryption method. The second entry assumes a separate SOCKS5 service is already running locally on 1080. If that port is actually an inbound port on this same core, selecting the node will send requests back to itself and create a loop or repeated connections. When replacing the example, point the outbound address to the actual service; don’t simply copy your local proxy settings into the node fields. Neither example is a ready-to-use public proxy.

Check authentication, transport, and hostnames separately

Authentication methods aren’t interchangeable across protocols. Shadowsocks uses the credentials required by its selected method. SOCKS5 can use a username and password if the server requires them. Other protocols may need a uuid, TLS, or additional transport options. Renaming a node doesn’t change its protocol, and changing type alone won’t convert its old fields to another protocol. If a subscription import has incompatible fields, get a config format supported by the core from the source, then compare the node entries. A share link or Base64 list may not include proxy groups and rules. See subscription links and config formats to decide whether to import a file or a link.

For nodes that use TLS, check the server used for the actual connection separately from the server name used in the TLS handshake. The field for the latter varies by node type; don’t assume every protocol uses the same key. If the address is reachable but the handshake fails, check the certificate hostname, system time, upstream requirements, and transport path. Disabling certificate verification isn’t a routine fix; it can hide certificate or hostname errors. Setting udp: true only lets the core try to forward UDP through that node. The protocol, remote service, entry point, and proxy policy must all support it too.

Separate node failures from proxy group failures

Select a single node and test a specific destination. If the log says a name can’t be found, check the reference and whether the subscription has updated. If the hostname fails to resolve, check the DNS settings for the proxy server. For a timeout, verify the destination address, port, and current outbound route. If authentication fails, check the protocol settings and credentials. If multiple groups contain a node with the same name, note which group the connection actually passed through; the client interface may show one group selected while the active rule routes through another.

Manage large sets of nodes with proxy-providers and include them in a group with use. A provider name and a node name are referenced in different places: use specifies a source, while proxies lists specific nodes, other groups, or built-in policies. Subscription updates may rename or remove nodes. If you make long-term manual references to names that can change, set up a simple fallback group and check the candidate list after each update. Otherwise, a group still referenced by a rule may stop working because it has no valid outbound. Before sharing a troubleshooting snippet, replace credentials and subscription links; keep only what’s needed to show the field structure.

Proxy groups

Proxy groups connect rules to outbounds

proxy-groups doesn’t create new servers. It defines how to select an existing outbound when a rule matches. Each group has its own name, type, and candidate sources. Rules can reference a group name, and a group can list node names, built-in policies, or other group names. This lets you manage which traffic goes to a work group separately from which node that group currently uses. When a server changes, you can often update the node or group without replacing the target in every rule. Avoid giving a group the same name as a node, and don’t make groups reference each other in a loop.

config.yaml · Manual and automatic test groups
proxy-groups:
  - name: Candidate-Test
    type: url-test
    proxies:
      - Lab-SS
      - Lab-SOCKS
    url: https://www.gstatic.com/generate_204
    interval: 300
    tolerance: 80
  - name: Work
    type: select
    proxies:
      - DIRECT
      - Candidate-Test
      - Lab-SS

These groups reference the two nodes from the previous section. Replace the names with ones that actually exist in your config before pasting. Work is a manual selection group for choosing a node, handing off to an automatic group, or switching to a direct connection. Candidate-Test checks candidate reachability and response time using the specified URL. interval is in seconds; tolerance is in milliseconds, so small latency differences won’t trigger frequent switches. Choose a URL that’s reliably reachable and returns the expected response, and make sure the test behavior complies with the rules of your network. If the test endpoint itself is having problems, don’t use it to declare every node faulty.

TypeHow it selectsTypical use
selectUser manually selects a candidatePin an outbound or troubleshoot candidates one by one
url-testSelects based on test results and toleranceDynamically choose among equivalent candidates
fallbackSelects the first available candidate in list orderMaintain primary and backup priorities
load-balanceDistributes connections according to the selected policyWorkloads where different connections can use different outbounds

What latency and availability tests can tell you

A latency result is a single probe to a specified address. It doesn’t measure download bandwidth or the stability of an entire route, and it doesn’t prove that you can sign in to a particular site. For services that need a consistent outbound IP to maintain a session, pin an outbound with a manual group rather than starting with load balancing. fallback prioritizes list order; it doesn’t pick the lowest latency. Automatic switching usually affects new connections only and can’t seamlessly move an interrupted session to another node. If the interface shows only timeouts, temporarily select a node manually and test again against a destination closer to your actual workload. See the node latency test guide.

Adding DIRECT to a test group may cause it to be selected simply because it responds faster. If a workload must use a proxy, don’t include a direct connection in the same automatic candidate pool. For traffic that should stop explicitly on failure, consider using REJECT in a dedicated manual group or rule instead of quietly sending it along another path. An availability check and a rule target make different decisions: the check evaluates candidate health, while the target determines which outbounds that connection may use.

Check candidates and the active selection after updates

A client may restore the previous selection, so the first item in the list isn’t necessarily active. After changing a group, check the actual outbound chain shown in the connection log. Nodes provided by a provider may also be missing because of filter settings or a failed update. If the group still exists but has no candidates, first check whether its source loaded, then review the filter scope. Don’t change the source, filters, and group type all at once; if the problem disappears, you won’t know which change fixed it.

Name groups by the intent of their traffic rather than by the node names in use today. Have rules reference a small number of stable groups, and let those groups reference nodes that may change over time. For temporary troubleshooting, switch a candidate in a manual group and open a new connection. For a lasting change, update the group definition. This way, subscription updates won’t force you to reorganize the rules list, and group names in the logs will show where traffic was initially routed.

Rule syntax and order

Order rules by match conditions, not by target

With mode: rule, rules are usually checked from top to bottom. The first applicable match determines the outbound. A common rule has the form “type, match value, policy”; MATCH needs no match value, so put the target directly after it. Put a specific full domain before a suffix rule that would also match it, and keep the catch-all rule last. Rules aren’t automatically sorted by specificity, and later rules aren’t fallback routes if the first matching rule fails. To choose a backup node, configure a proxy group rather than duplicating rules with the same condition.

config.yaml · Exceptions, subnets, and catch-all
rules:
  - DOMAIN,health.example.com,DIRECT
  - DOMAIN-SUFFIX,example.com,Work
  - IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
  - IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
  - MATCH,DIRECT

This example assumes the Work proxy group already exists. health.example.com matches both the exact-domain and suffix conditions, but the first rule sends it direct. Other domains with the same suffix go to Work. The example uses a direct connection as the catch-all solely to demonstrate rule order. In a real config, decide whether unmatched traffic should go direct, to a proxy group, or be rejected before choosing the last rule. A direct rule for local network addresses doesn’t guarantee the operating system has a route to those subnets. Verify core matching and actual reachability separately.

TypeMatchesCommon gotcha
DOMAINA single fully qualified domain nameDon’t include a URL, path, or protocol
DOMAIN-SUFFIXA domain and all its subdomainsDoesn’t replace explicit rules for unrelated domains
IP-CIDRAn IPv4 address rangeMay not match if no address is available
IP-CIDR6An IPv6 address rangeAn IPv4 subnet can’t represent IPv6
RULE-SETA defined rule setThe reference name must match the rule source

Check whether the connection uses a domain name or an IP address

With an explicit proxy, an app may send a domain name directly to the core or resolve it first and send an IP address. TUN receives IP traffic; whether the core can recover the domain depends on a fake-IP mapping or other available domain information. If the connection log shows only an IP, a domain rule can’t match a name that isn’t available. Conversely, when a domain connection is checked against an IP rule, the core may need to resolve it to determine whether the address matches. For supported IP rule types, no-resolve means not to trigger a lookup specifically for that rule. It can still match if a destination address is already available; it doesn’t block all DNS lookups the connection may need later.

When troubleshooting a site, distinguish its main domain from the other domains needed to load the page. Login, static assets, and media may use different suffixes. Getting the main page through the right policy doesn’t mean its dependencies use the same one. Find the specific failed connection in the log and check its match type, rule, and outbound chain before adding only the rule you need. Broad keyword rules that send several domain groups to one target can override more specific routes you meant to keep.

Combine remote rule sets with local exceptions

Before using RULE-SET, define its source under rule-providers and choose the behavior that matches the data. Don’t treat domain lists, subnet lists, and lists containing multiple rule types as the same format. A matching reference name doesn’t prove that the source has updated; check the logs after startup or an update to confirm the rule set loaded successfully. Put local exceptions before broader remote rule sets to reduce the chance that a newly added entry matches first. A remote rule set decides whether a connection matches; the policy that follows must still be valid in your local config.

After a change, run at least three separate checks: test an exact domain against the exception, a different name with the same suffix against the general rule, and a destination outside that suffix against the catch-all. For IP subnets, use a direct destination you know enters the core as a comparison; don’t mistake DNS query logs for connection logs. If the test connection doesn’t appear in the logs, check the proxy endpoint and TUN capture rather than adding the same rule repeatedly to compensate for traffic that never reached the core.

Why doesn’t a new rule appended to the end ever match?

Check whether a preceding MATCH or broader suffix rule already covers the destination, then confirm that the mode is rule. After making changes, test with a new connection.

Overrides, merging, and rollback

Choose whether to edit the subscription or a local override

Subscription configs are suited to nodes and baseline rules that change with the source. Local overrides are better for device-specific preferences such as ports, DNS, and local network exceptions. GUI settings for the system proxy and service permissions are another layer: even if the final YAML retains tun.enable, the client may not create the device because of its run mode or permissions. Before editing, note the active subscription, enabled overrides, and runtime config. If a field appears in the subscription, client settings, and an override, check each layer to see which one ultimately writes the value. Don’t assume the value shown in the editor is the one read by the core.

Merge behavior is determined by the client; YAML doesn’t provide it automatically. At the same root key, a scalar may replace the old value, a mapping may merge recursively by key or replace the whole section, and a list may support prepending, appending, or full replacement. Entry points and processing order vary between clients. In particular, don’t paste one client’s override instructions directly into config.yaml. If the interface only labels the feature “Override,” test it by changing one scalar and one list in a copy that won’t affect your main config. Preview the result and confirm how merging works before updating your production configuration.

config.yaml · Complete baseline after manual merging
mixed-port: 7897
allow-lan: false
mode: rule
log-level: info
dns:
  enable: true
  enhanced-mode: redir-host
  nameserver:
    - 1.1.1.1
rules:
  - DOMAIN,health.example.com,DIRECT
  - MATCH,DIRECT

The code window shows the final result the core can read, not an override script for any specific client. Starting from the baseline in the first section, you could also keep the Local group, add dns, put exceptions at the start of the existing list, and retain the existing MATCH,Local. This standalone config removes the group that’s no longer referenced and points the catch-all directly to DIRECT. Either approach requires checking that all references still resolve. Before deleting a group, check the rules; if other groups reference it, update those references too. Don’t remove a definition without updating its callers.

Check merge results by value type

For scalars, check the final value—for example, whether the port is still a number and whether the client switched the mode to global. For mappings, verify that unmodified sibling fields remain. If you meant to override only dns.ipv6 but nameserver is missing from the result, the whole section was replaced or another layer overwrote it afterward. For lists, check each item, its position, and duplicate names. A new rule after MATCH may be valid YAML but won’t work as intended. Replacing the entire proxies list with two manually entered nodes may break references from other proxy groups.

YAML anchors and aliases reuse existing content only within the document and parser features that support them. They can’t reference definitions across subscription files or express “insert before the first matching rule.” Even when a parser supports merge keys for mappings, that doesn’t make it a recursive merge tool, and it won’t deduplicate nodes by name. If the client provides a dedicated prepend, append, or scripting interface, follow its rules and check the generated result. For manual merging, keep one readable, complete config rather than relying on unverified parser behavior.

Apply, retest, and roll back

Before making changes, copy a local config that starts successfully and note the currently selected proxy group candidate. After applying the new config, confirm that the core loads it, then test the local endpoint, DNS resolution, and a connection with a clear matching rule. Don’t change nodes, DNS, and traffic capture at the same time. Change one logical section at a time, and move on only after a new connection produces the expected log. Test again after subscription updates, which may rename groups or change rule sources; an override that works with the current preview may no longer fit the updated structure. See the subscription import steps in the guide.

If something goes wrong, first disable the override you just enabled or switch back to the config you noted earlier instead of immediately clearing client data. If the old config still doesn’t work, check whether system proxy settings, TUN routes, and app caches have also returned to their pre-test state. Use the direct-connection baseline to determine whether the core’s entry point is broken or the final config has a DNS or outbound issue. Once you’ve identified the cause, move only the necessary changes into the override and leave a short note describing the fields changed, why they’re needed, and a connection you can use to retest.