Shadowrocket .conf files organize settings into sections; adding a subscription URL alone won’t configure traffic routing. This guide is for users who already have their own provider and subscription and want to review a configuration in Config. Start by understanding what each section does, then review examples for rules, domain mappings, and redirects. Make one change at a time, reconnect, and check the request log to verify the result.
1. .conf Section Names, Key-Value Pairs, and When Settings Take Effect
A configuration file is plain text. Names in square brackets identify sections, such as [General]. Everything up to the next section belongs to the current one. Preserve spaces in section names: don’t change [URL Rewrite] to a different spelling. Settings typically use the key = value format, while rules use comma-separated fields. These formats are not interchangeable.
Home manages connections and server selection; Config manages configuration files. Importing or saving text does not enable it. In Config, make sure the intended file is selected, then go to Home → Global Routing and choose Config. Proxy routes all traffic through the proxy, while Direct routes it directly. Scene selects a routing mode according to the configured scene. When checking rule order, keep routing set to Config so a scene change doesn’t affect the result.
The example below shows a standalone basic structure. Unmatched traffic goes to DIRECT, making it useful for checking whether the file parses correctly. It is not a ready-made configuration for every network. example.com is a documentation example domain, not a service provided by this site.
[General]
dns-server = system
[Rule]
DOMAIN-SUFFIX,example.com,DIRECT
IP-CIDR,192.0.2.0/24,DIRECT,no-resolve
FINAL,DIRECT
- Edit the file as plain text and use standard ASCII punctuation. Don’t append explanatory text to a rule on the same line.
- Put each rule on its own line. For a note, start a new line with
#. - Keep a copy of the original file, then edit a separate test copy. Don’t change DNS, rules, and rewrites at the same time.
- Real-world configuration files may contain more sections; the four covered here are not a complete list of the app’s capabilities.
2. General: Basic Configuration, Not Rule Ordering
Use [General] for global settings. For example, dns-server = system uses the system DNS settings; it does not guarantee that the selected resolver is reachable on every network. Before changing this line to use another DNS method, note your current Wi-Fi or cellular network, the domain you’re testing, and what happens when the request fails.
DNS resolves domain names to IP addresses; Rule selects a traffic policy. They’re related, but they aren’t the same setting. If name resolution fails, adding a DOMAIN-SUFFIX rule won’t fix the resolver. Likewise, a DNS response doesn’t mean the destination port or proxy route is reachable.
General: Basic Checks
- Section
[General]- Setting
dns-server- Example value
system- Syntax
dns-server = system
Check the current resolution method before deciding whether to change it.
Check That It Takes Effect in the App
- File location
- Config
- Routing entry
- Home → Global Routing
- Routing mode for testing
- Config
- Automatic connection entry
- Settings → On Demand
On Demand controls when to connect based on conditions; it doesn’t replace Rule matching logic.
When editing the file, don’t guess what a setting does based on its name. Unsupported or unverified keys may be ignored or cause parsing issues. To add General settings, refer to the corresponding options and descriptions in the app’s configuration editor, and keep a record of the original values. Check On Demand separately so automatic reconnections don’t interrupt troubleshooting.
3. Rule: Match from Top to Bottom, with FINAL Last
Each line in [Rule] defines a matching condition and an action. Rules are evaluated in order, and the action for the first match is applied. Put specific domain rules before broader rules, and place FINAL last. If a catch-all rule comes first, later rules won’t get the intended chance to match.
[Rule]
DOMAIN-SUFFIX,example.com,PROXY
IP-CIDR,192.0.2.0/24,DIRECT,no-resolve
GEOIP,CN,DIRECT
FINAL,PROXY
| Keyword | What the example means | What to check |
|---|---|---|
DOMAIN-SUFFIX | Matches example.com and its subdomains. | Enter the domain only—no scheme, port, or path. |
IP-CIDR | Matches addresses in the 192.0.2.0/24 range. | This is a documentation-only address range, not a usable server address. |
GEOIP | Matches CN based on an IP geolocation database. | The result depends on the IP geolocation database, not the domain suffix alone. |
FINAL | Routes requests that didn’t match earlier rules through PROXY. | There’s no match-value field; write it as FINAL,PROXY. |
no-resolve prevents DNS lookup solely for matching this IP rule. It does not turn off all DNS: the request itself or other rules may still require name resolution. If a request has a domain name but no IP address to match against, an IP rule with no-resolve may not match. Check the actual request log.
PROXY and DIRECT are routing policies, not protocol names. Shadowsocks, VMess, VLESS, Trojan, Hysteria2, and WireGuard describe connection protocols; connection details still come from your own service. Setting a policy to PROXY won’t create a working connection. Before testing, make sure a usable server is configured in Home.
Troubleshoot Rule Matching: Check Which Line Matched First
If a domain isn’t routed as expected, check the request log for the domain, matched rule, and policy before moving that specific rule. Don’t start by changing all General settings, or you won’t know which change made a difference.
4. Host: Map Domains to Addresses, Not to Routing Policies
Use [Host] to map domain names to addresses. The basic syntax is domain = IP address. This changes the address associated with a domain; it doesn’t replace DIRECT or PROXY in Rule or make an unreachable address reachable.
[Host]
lab.example.com = 192.0.2.10
This snippet demonstrates the syntax only. 192.0.2.10 is a documentation-only address and cannot be used to test connectivity. In your own test environment, use a domain you control and an address that is actually reachable, and check which port the service listens on. A Host entry maps a name; don’t append a port like 192.0.2.10:443. HTTP commonly uses TCP port 80 and HTTPS TCP port 443; the port is determined by the URL or the app’s connection settings.
- Enter the domain as
lab.example.com, not ashttps://lab.example.com/path. - For HTTPS, the server certificate must still match the requested domain. Pinning an IP address does not bypass certificate validation.
- Close the existing connection and make a new request before testing, so a reused connection or cached response doesn’t hide the change.
- Remove the test mapping and check again to make sure a temporary address hasn’t been left in the production configuration.
If the address changes but the page still won’t load, check reachability, the service on the port, the certificate, and the routing policy separately. Host can help diagnose name resolution; it’s not a good idea to put arbitrary addresses found online in a long-term configuration.
5. URL Rewrite: Match a URL and Set a Redirect Action
[URL Rewrite] handles URL matching and rewriting. This example uses a regular expression to match an HTTP URL, then returns a redirect to the target with 302. It doesn’t create a DNS mapping or provide another way to route a domain through PROXY.
[URL Rewrite]
^http://example\.com/(.*)$ https://example.com/$1 302
^anchors the match to the start of the URL, and$anchors it to the end, so the expression doesn’t match only part of the address.- In
example\.com, the dot is escaped to match a literal period, not any character in the regular expression. (.*)captures everything after the slash;$1in the target refers to the first capture group.302specifies a redirect. The browser receives it and makes a separate request to the target; traffic isn’t passed directly between the two endpoints.
This expression matches only URLs starting with http://example.com/. It won’t match https://example.com/ or http://example.com:80/ with an explicit port. Document these boundaries before testing. Don’t loosen the domain match just to “match everything,” or unrelated requests may be rewritten.
If redirects loop, remove the new rewrite rule first and check the original site’s response. Even a one-way HTTP-to-HTTPS rule can interact with the server’s own redirects. Record the initial URL, response status, and redirect target separately instead of checking only whether the final page loads.
6. Test One Section at a Time: Separate Resolution, Routing, and Rewriting
The four sections cover basic behavior, traffic routing, hostname mapping, and URL handling. They aren’t four steps in a fixed pipeline. How a request is handled depends on factors such as whether it needs DNS resolution, whether the URL is visible, and whether a domain rule matches. The figures below describe this guide’s examples, not the app’s full support range.
- Keep a copy of the original file in Config and make sure the test file is selected. On Home → Global Routing, set routing to Config.
- Test General and Rule first, without other changes. Use a destination you know is reachable, and note the time, network type, and selected server.
- Disconnect and reconnect, then make a new request. Distinguish DNS errors, connection timeouts, TLS errors, and HTTP status codes.
- If you need Host, add just one mapping for a domain you control and compare the destination address before and after.
- Test URL Rewrite separately at the end and check the redirect target. If it fails, undo the most recent change instead of replacing the whole configuration.
A successful server latency test only shows that the specific test received a response. It doesn’t prove that the target website’s DNS, TCP 443, TLS, and HTTP request are all working. An HTTP 403 means the server returned a response; check its access requirements rather than assuming the .conf syntax is at fault.
7. FAQ: Why Didn’t My Changes Take Effect After Saving the File?
I changed Rule, but all websites still go through the proxy. Why?
First check whether Home → Global Routing is set to Proxy. Change it to Config, then return to Config and make sure the edited file is selected. Reconnect, make a new request, and check the matched rule. Don’t judge the routing policy just by how quickly a webpage loads.
Can I put FINAL at the top of the file?
Put it at the end of the Rule section. Move specific domain and address rules above it. For example, write DOMAIN-SUFFIX,example.com,DIRECT first, then FINAL,PROXY, so the domain can match the direct rule.
Will my configuration edits survive a subscription update?
First, distinguish server subscriptions in Home from remote configurations in Config. Updating a server subscription typically refreshes server entries. Fetching a remote configuration again may overwrite local edits. To keep your changes, put them in a separate local copy and confirm that it remains selected after updating.
Why does HTTPS fail after I map a domain to an IP in Host?
Check whether that IP hosts the HTTPS service for the domain and whether its certificate covers the domain. Remove the Host mapping and compare the result. Don’t disable certificate validation instead of fixing the domain, address, or server configuration.
After saving, check three things: the correct file is selected, Global Routing is set to the intended mode, and a new request matches the expected rule. Once these are confirmed, investigate DNS, the destination service, and rewrite boundaries. This helps avoid mistaking a connection problem for a file-format error.