A Shadowrocket .conf file is a plain-text configuration that can define proxy entries, proxy groups, routing rules, and related settings. The most important habits are to preserve the file’s section structure, use policy names consistently, and put specific rules before broad rules and the final fallback. This guide explains the common sections, provides a sanitized example, and walks through a safe edit-and-test workflow. It assumes you already have your own connection details; this site does not provide, sell, or recommend nodes or subscriptions.
Understand the file structure before editing
A .conf file is organized into named sections. A section header appears on its own line inside square brackets, such as [General], [Proxy], [Proxy Group], or [Rule]. The lines below a header belong to that section until the next header begins. A value that is valid in one section may not be valid in another, so moving a line without checking its meaning can make the file fail to load or behave differently from what you intended.
Think of the file as a set of related layers. [Proxy] defines individual connection entries; [Proxy Group] gives those entries a reusable policy name; and [Rule] decides which policy should handle matching traffic. [General] contains broader behavior settings. Other sections may be present for features such as host mappings or rewriting, but you do not need to add optional sections just because they appear in an example from another configuration.
- Section headers: Keep the square brackets and spelling intact. Do not put a proxy definition under
[Rule]or a routing rule under[Proxy]. - Names: Treat proxy and group names as references. If a rule uses a policy called
Example-Proxy, that name must match the relevant proxy or group definition. - Separators: In many entries, commas divide fields and equals signs assign a value. A missing comma, extra comma, or accidental line break can change how a row is parsed.
- Order: Section order and rule order are different questions. Keep definitions in their intended sections, and arrange rules from specific cases to broad cases.
Start with the file that is currently selected in Config, not an old copy whose status is unclear. Before editing, export or duplicate the current file and make a small change in the copy. A configuration can contain server addresses, passwords, keys, or subscription-related information. Store backups somewhere you control, and redact credentials before sharing any diagnostic excerpt.
Map the common sections to their jobs
The table below is a practical orientation, not a requirement that every file contain every section. A provider-supplied configuration may include additional settings or use a different layout. Preserve working entries you do not understand rather than deleting them during a first cleanup.
| Section | Typical purpose | What to verify |
|---|---|---|
[General] | Sets general behavior, such as DNS-related or system handling options, when those options are included. | Check each option against the configuration’s intended use. Do not copy an unfamiliar value from an unrelated file. |
[Proxy] | Defines individual proxy entries and the connection parameters required by each entry. | Confirm the type, server, port, and authentication fields match your own connection details. |
[Proxy Group] | Defines a policy that can refer to one or more proxy entries or other available policies. | Check that every referenced name exists and is spelled consistently. |
[Rule] | Maps matching domains, addresses, or other supported conditions to a policy such as a proxy group or DIRECT. | Review rules from top to bottom and confirm the final rule provides the intended fallback. |
[Host] | Can specify host-related mappings in configurations that use this section. | Keep entries only when you understand the mapping and have a reason to maintain it. |
[URL Rewrite] or other feature sections | May hold feature-specific behavior supported by the configuration format. | Confirm that the active file and app version support the syntax before adding entries. |
Some settings and supported section names can depend on the configuration format and Shadowrocket version. When a file already works, use its existing syntax as the first reference. If you are merging snippets, compare their section names, separators, policy references, and comments rather than assuming that similarly named settings from another source are interchangeable.
Build proxy entries and groups with consistent names
A proxy entry describes one connection. It is not a routing rule: defining an entry does not by itself send every request through it. In the example below, the server address is from the reserved documentation range, and the password is a placeholder. Neither is a working service configuration. Replace example fields only with values from a configuration you already control, and retain the protocol’s required parameters.
[Proxy]
Example-Node = ss, 203.0.113.10, 443, encrypt-method=aes-128-gcm, password=REPLACE_WITH_YOUR_OWN_VALUE
[Proxy Group]
Example-Proxy = select, Example-Node, DIRECT
The first field after the equals sign identifies the connection type in this example; the remaining fields describe the server and its parameters. A different protocol requires its own appropriate fields. Do not change the type to make an entry fit a template, and do not replace a supplied port with 443 merely because the example uses it. The address, port, authentication, and protocol details must come from your own valid configuration.
The group named Example-Proxy gives rules a policy name to use. The select group type represents a selection-style group; its members must refer to entries that are actually defined. In a real file, a group can contain several available entries, but adding names that do not exist creates a broken reference. Keep naming predictable: if a name contains spaces, punctuation, or mixed capitalization, copy it exactly wherever it is referenced.
Proxy entry checklist
- Type
- Use the protocol specified by your own connection details.
- Server
- Enter the supplied host or IP address without changing it.
- Port
- Keep the supplied port; do not infer it from an example.
- Credentials
- Preserve required passwords, keys, and method fields.
A syntactically complete entry still needs valid connection parameters.
Group reference checklist
- Group name
- Use one stable name in the group and all rules.
- Group type
- Choose a type that matches the intended selection behavior.
- Members
- Reference defined entries or valid policies only.
- Fallback
- Decide deliberately whether the group should include DIRECT.
A group organizes available policies; it does not replace the rules that select them.
Keep sensitive values out of examples you post publicly. A server address may not be secret by itself, but a complete entry can reveal account details when combined with keys, passwords, or a subscription token. When asking for help, share only the smallest relevant excerpt and replace credentials with clear placeholders.
Write rules in evaluation order
In a rule-based setup, Shadowrocket evaluates matching rules in order. Once a request matches a rule, that rule’s policy determines the route; a later, broader rule will not normally override an earlier match. This makes ordering essential. Put a narrow domain exception above a domain suffix that would also match it, and keep broad regional or fallback rules near the bottom.
The following example illustrates the structure. The policy names are examples, and the reserved IP range is not a real destination. Use only rule types and policies supported by the configuration you are editing.
[Rule]
DOMAIN,login.example.com,Example-Proxy
DOMAIN-SUFFIX,example.com,Example-Proxy
DOMAIN-KEYWORD,media,Example-Proxy
IP-CIDR,192.0.2.0/24,DIRECT,no-resolve
GEOIP,CN,DIRECT
FINAL,Example-Proxy
Read each row as a condition followed by a policy. DOMAIN is for a specific domain; DOMAIN-SUFFIX is for a domain and its subdomains; and DOMAIN-KEYWORD matches a keyword in a domain. IP-CIDR matches an address range, while GEOIP applies a geographic IP condition. FINAL is the catch-all for requests that did not match an earlier rule. The exact set of supported rule types and optional parameters should be checked against the active configuration and app behavior.
In this sample, the specific login domain is listed before the broader example.com suffix. If the broader suffix appeared first, the specific line might never decide the route for that request. Likewise, GEOIP,CN,DIRECT above FINAL,Example-Proxy means matching requests use DIRECT, while unmatched requests reach the final policy. Changing the final policy changes the behavior of every request that has not matched a preceding rule, so treat it as a deliberate choice rather than a harmless default.
Keep rule policies aligned with names in [Proxy Group] or valid built-in policies such as DIRECT. Do not assume that a policy label in a comment creates a group. If a request appears to ignore your intended route, check the active Global Routing mode as well as the file: opening the Config tab to view files is not the same as selecting Config as the routing mode.
Bottom line: specific rules first, fallback last
Before adding a rule, identify the requests it can match and compare that scope with rules above it. Then confirm that the policy name exists and that FINAL expresses the fallback you actually want.
Edit, validate, and troubleshoot in a controlled sequence
Make one change at a time. If you rewrite several sections at once, a parser error, an unresolved policy, and a routing mistake can become difficult to distinguish. Keep a known-good copy, make the edit in a working copy, then select the intended file in Config and test a request whose expected route is clear. Menu placement can differ across platforms, but the core checks—active file, Global Routing mode, rule order, and referenced policy—remain useful on iPhone, iPad, Mac, Windows, Android, and Linux.
-
Save a backup
Export or duplicate the current .conf file before editing. Keep the original unchanged until the edited version loads and passes your tests.
-
Check sections
Confirm each header uses square brackets and each entry is under the appropriate section. Remove accidental blank fragments or a line that was pasted into the wrong section.
-
Check references
Compare every policy in
[Rule]with the names in[Proxy Group]and[Proxy]. Match spelling and capitalization exactly. -
Select the file
In Config, verify that the edited file is the one in use. Then check that Global Routing is set to Config if you expect the file’s rules to control routing.
-
Test one case
Use a known domain or request that should match one rule. Check the activity in Data, then compare the observed policy with the rule order and fallback.
Why does the file load, but traffic use the wrong route?
First check Home and Global Routing: the connection switch must be on, and Global Routing should be Config if you expect rule-based routing. Then check the active file, move the specific rule above broader matches, and confirm the rule’s policy name exists.
What should I check after a parse error?
Restore the last working copy if necessary, then inspect the most recent edit for a missing comma, misplaced equals sign, incomplete section header, or line pasted into the wrong section. Reapply one change at a time instead of replacing the entire file.
Can I copy a rule from another configuration?
Only after checking that the rule type, optional parameters, policy name, and referenced group are supported and present in your file. A copied rule is not self-contained if its policy points to a group that was not copied.
If a connection fails after the configuration loads, separate syntax from connectivity. A successful parse means the file was understood; it does not confirm that a server address, port, authentication value, DNS behavior, or network path is correct. Review those details against your own provider’s configuration, and avoid posting subscription URLs or credentials in screenshots. Shadowrocket is the client; the configuration and service details must come from sources you already control.