Clash Verge Rev Override Tutorial: Customize Rules Like a Pro
Table of Contents
- Introduction to Clash Verge Rev Overrides
- Understanding the Three Override Types
- Step-by-Step: Creating a Merge Profile
- Step-by-Step: Writing JavaScript Script Profiles
- Advanced Rule Injection and Traffic Splitting
- Modifying DNS and Sniffer Settings via Overrides
- Troubleshooting Common Override Errors
- Best Practices for Maintaining Your Overrides
Introduction to Clash Verge Rev Overrides
Clash Verge Rev has rapidly become the premier desktop client for proxy management, powered by the highly efficient mihomo core. However, relying solely on imported subscription profiles limits your control. When your provider updates the subscription, any manual tweaks you made directly to the YAML file are instantly overwritten. This is where clash verge rev overrides become indispensable.
Overrides allow you to apply custom configurations, rules, and scripts on top of your base subscription dynamically. They ensure your personalized settings survive subscription updates, giving you the flexibility to route specific traffic, tweak DNS resolution, and inject custom proxy groups without ever touching the original subscription file. In this tutorial, we will dive deep into the mechanics of overrides and show you how to customize your setup like a true professional.
Understanding the Three Override Types
Clash Verge Rev provides three distinct types of override profiles, each serving a specific purpose in your configuration pipeline. Understanding when to use each type is crucial for maintaining a clean and efficient setup.
Merge Profile
The Merge profile utilizes YAML deep-merge semantics. It takes your custom YAML configuration and overlays it onto the base subscription. If a key exists in both, the merge profile's value typically takes precedence, or arrays are appended depending on the core's implementation. This is the safest and most common method for adding static rules, modifying DNS settings, or appending proxy groups.
Script Profile
For dynamic and complex transformations, Script profiles are the way to go. Clash Verge Rev supports both JavaScript and Lua. The script receives the parsed base configuration as an object, allowing you to iterate through arrays, conditionally inject rules based on node names, or completely restructure proxy groups before the core loads the config.
Global Profile
The Global profile completely replaces the base subscription configuration. This is rarely used for daily driving because it defeats the purpose of subscription updates, but it is highly useful for testing entirely custom configurations or running a standalone local proxy setup without any external subscriptions.
Step-by-Step: Creating a Merge Profile
Let us start with the most straightforward override method. We will create a Merge profile to inject a custom routing rule and enforce a specific DNS configuration.
Navigate to the Profiles section in the left sidebar. Click the New button. In the dialog, set the Type to Merge. Give it a descriptive name like Custom Rules & DNS and click Save.
Click the edit icon next to your new Merge profile. Paste the following YAML structure. This example routes a specific corporate domain directly and forces fake-ip DNS resolution.
rules:
- DOMAIN-SUFFIX,internal-corp.com,DIRECT
- DOMAIN-SUFFIX,secure-bank.com,Proxy
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- https://dns.alidns.com/dns-query
fallback:
- https://dns.cloudflare.com/dns-query
Ensure the chain icon next to your base subscription and this new Merge profile are both highlighted, indicating they are active. Click the Reload button in the top right corner. Go to the Logs or Connections tab to verify that traffic to internal-corp.com is bypassing the proxy.
Step-by-Step: Writing JavaScript Script Profiles
When you need to manipulate the configuration based on the actual nodes provided by your subscription, a Script profile is required. We will write a JavaScript function to automatically group all nodes containing the word 'Japan' into a dedicated proxy group.
Go to Profiles, click New, and select Script as the type. Choose JavaScript as the language. Name it Auto Group Japan Nodes.
Open the editor and write the following script. The main function receives the config object. We will filter the proxies and inject a new select group.
function main(config) {
// Filter proxies that contain 'Japan' or 'JP' in their name
const japanNodes = config.proxies.filter(
p => p.name.includes('Japan') || p.name.includes('JP')
);
if (japanNodes.length > 0) {
// Create a new proxy group
const japanGroup = {
name: 'Japan Auto',
type: 'select',
proxies: japanNodes.map(p => p.name)
};
// Inject the group at the beginning of the proxy-groups array
config['proxy-groups'].unshift(japanGroup);
// Add a rule to route specific traffic to this new group
config.rules.unshift('DOMAIN-SUFFIX,anime-streaming.jp,Japan Auto');
}
return config;
}
Save the script and activate the profile chain. Reload the configuration. Navigate to the Proxies tab. You should now see a new group named Japan Auto at the very top, populated dynamically with your subscription's Japanese nodes.
Advanced Rule Injection and Traffic Splitting
Mastering overrides allows you to implement sophisticated traffic splitting strategies that go far beyond basic geo-IP routing. By combining Merge profiles with external rule providers, you can maintain highly granular control over your network traffic.
Instead of hardcoding hundreds of domains, you can inject RULE-SET directives via overrides. This keeps your configuration clean and allows you to update rules independently. For a comprehensive breakdown of how to structure these rules and implement split routing for different applications, refer to our detailed Clash Split Routing Rules Guide.
Here is how you inject a remote rule-set via a Merge profile:
rule-providers:
custom-ads:
type: http
behavior: domain
url: 'https://raw.githubusercontent.com/example/rules/main/ads.yaml'
path: ./ruleset/ads.yaml
interval: 86400
rules:
- RULE-SET,custom-ads,REJECT
Finally, always conclude your injected rules with a MATCH directive if you are completely rewriting the rules array via a script, or ensure your Merge profile appends rules correctly so the default fallback at the end of the subscription remains intact. Misplacing the fallback rule is a frequent cause of traffic leaks.
Modifying DNS and Sniffer Settings via Overrides
The mihomo core includes a powerful sniffer that can analyze raw traffic to determine the actual domain being accessed, bypassing IP-based routing limitations. However, default sniffer settings might conflict with certain local network setups. You can override these settings to fine-tune performance and compatibility.
Always ensure your nameserver uses encrypted DNS (DoH/DoT) to prevent ISP hijacking. When enabling the sniffer, explicitly define which ports to sniff to avoid performance degradation on high-throughput local traffic.
sniffer:
enable: true
sniff:
HTTP:
ports: [80, 8080]
TLS:
ports: [443, 8443]
QUIC:
ports: [443, 8443]
skip-domain:
- 'Mijia Cloud'
- '+.apple.com'
dns:
enable: true
listen: '0.0.0.0:1053'
ipv6: false
default-nameserver:
- 223.5.5.5
- 119.29.29.29
nameserver:
- 'https://doh.pub/dns-query'
fallback:
- 'https://dns.google/dns-query'
fallback-filter:
geoip: true
geoip-code: CN
Troubleshooting Common Override Errors
Even with the best intentions, syntax errors or logical flaws in your overrides can cause the mihomo core to fail to start. When Clash Verge Rev fails to load the configuration, it usually points to an issue in the override chain.
Never edit the raw subscription file directly. If you do, your changes will be lost on the next update, and you risk breaking the provider's original structure. Always use overrides.
The most common errors include invalid YAML indentation in Merge profiles and undefined proxy group names in rules. If a rule points to a group that does not exist, the core will crash. To debug this, switch to the Runtime tab in Clash Verge Rev. This tab shows the final, merged configuration that is actually sent to the core. Compare it against your expectations to spot missing keys or malformed arrays.
If you are struggling with basic rule syntax or proxy group definitions before even attempting overrides, it is highly recommended to review the foundational concepts in our Clash Rule Configuration Tutorial first.
Best Practices for Maintaining Your Overrides
As your configuration grows, managing multiple overrides can become chaotic. Adopting a structured approach will save you hours of debugging in the long run.
Instead of one massive Merge profile, create separate profiles for DNS, Rules, and Proxy Groups. This makes it incredibly easy to disable a specific module without affecting the rest of your setup.
Furthermore, keep your JavaScript scripts clean and well-commented. Use descriptive variable names and avoid hardcoding node names whenever possible; rely on pattern matching instead. For advanced users, consider storing your override scripts and merge YAML files in a local Git repository. You can then use the 'Local File' option when creating a new profile in Clash Verge Rev, pointing directly to your version-controlled files. This allows you to track changes, revert broken configurations instantly, and share your sanitized override setups with the community without exposing your actual subscription links.
Finally, regularly review your Clash Verge Rev Tips & Hidden Features to discover new client updates that might introduce native UI features, potentially eliminating the need for complex script overrides. By mastering clash verge rev overrides, you transform a simple proxy client into a highly customized, resilient network gateway tailored exactly to your workflow.